Package dk.vajhoej.model.core
Class Box
- java.lang.Object
-
- dk.vajhoej.model.Versioned
-
- dk.vajhoej.model.core.Box
-
- All Implemented Interfaces:
Duplicatable
,Persistable
,java.io.Serializable
,java.lang.Cloneable
public class Box extends Versioned implements Persistable, Duplicatable, java.io.Serializable
Class Box represents a hardware box.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Box()
Create instance of Box.Box(java.lang.String name, Version version, java.lang.String vendor, java.lang.String model)
Create instance of Box.Box(java.lang.String name, Version version, java.lang.String vendor, java.lang.String model, BoxType boxtype, int cpu, double mem, double disk)
Create instance of Box.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComponent(Component c)
Add component.Box
duplicate()
Duplicate object.boolean
equals(java.lang.Object o)
NameValuePairList
getAttributes()
Get all single value fields.BoxType
getBoxtype()
Get box type.java.util.List<java.util.List<Persistable>>
getChildren()
Get all multi value fields.java.util.List<Component>
getComponents()
Get components.int
getCpu()
Get CPU.double
getDisk()
Get disk space.java.lang.String
getId()
Get id identifying object.double
getMem()
Get memory.java.lang.String
getModel()
Get model.java.lang.String
getName()
Get name.java.lang.String
getType()
Get type (XML element name / database table name not Java class name).java.lang.String
getVendor()
Get vendor.int
hashCode()
void
removeComponent(Component c)
Remove component.void
setAttributes(NameValuePairList attr)
Set all single value fields.void
setChildren(java.util.List<java.util.List<Persistable>> childs)
Set all multi value fields.void
setCpu(int cpu)
Set CPU.void
setDisk(double disk)
Set disk space.void
setId(int id)
Set ID.void
setId(java.lang.String id)
Set ID.void
setMem(double mem)
Set memory.void
setModel(java.lang.String model)
Set model.void
setName(java.lang.String name)
Set name.void
setVendor(java.lang.String vendor)
Set vendor.java.lang.String
toString()
-
Methods inherited from class dk.vajhoej.model.Versioned
clone, getVersion, setVersion
-
-
-
-
Constructor Detail
-
Box
public Box()
Create instance of Box.
-
Box
public Box(java.lang.String name, Version version, java.lang.String vendor, java.lang.String model)
Create instance of Box.- Parameters:
name
- nameversion
- versionvendor
- vendormodel
- model
-
Box
public Box(java.lang.String name, Version version, java.lang.String vendor, java.lang.String model, BoxType boxtype, int cpu, double mem, double disk)
Create instance of Box.- Parameters:
name
- nameversion
- versionvendor
- vendormodel
- modelboxtype
- box typecpu
- CPU coresmem
- GB memorydisk
- TB disk space
-
-
Method Detail
-
getName
public java.lang.String getName()
Get name.- Returns:
- name
-
setName
public void setName(java.lang.String name)
Set name.- Parameters:
name
- name
-
getVendor
public java.lang.String getVendor()
Get vendor.- Returns:
- vendor
-
setVendor
public void setVendor(java.lang.String vendor)
Set vendor.- Parameters:
vendor
- vendor
-
getModel
public java.lang.String getModel()
Get model.- Returns:
- model
-
setModel
public void setModel(java.lang.String model)
Set model.- Parameters:
model
- model
-
getComponents
public java.util.List<Component> getComponents()
Get components.- Returns:
- unmodifiable list of components
-
addComponent
public void addComponent(Component c)
Add component.- Parameters:
c
- components
-
removeComponent
public void removeComponent(Component c)
Remove component.- Parameters:
c
- component
-
getBoxtype
public BoxType getBoxtype()
Get box type.- Returns:
- box type
-
getCpu
public int getCpu()
Get CPU.- Returns:
- CPU cores
-
setCpu
public void setCpu(int cpu)
Set CPU.- Parameters:
cpu
- CPU cores
-
getMem
public double getMem()
Get memory.- Returns:
- GB memory
-
setMem
public void setMem(double mem)
Set memory.- Parameters:
mem
- GB memory
-
getDisk
public double getDisk()
Get disk space.- Returns:
- TB disk
-
setDisk
public void setDisk(double disk)
Set disk space.- Parameters:
disk
- TB disk
-
setId
public void setId(java.lang.String id)
Set ID.- Parameters:
id
- id
-
setId
public void setId(int id)
Set ID.- Parameters:
id
- id
-
duplicate
public Box duplicate()
Description copied from interface:Duplicatable
Duplicate object. The result will have the same characteristics as the original but may not be equal to it.- Specified by:
duplicate
in interfaceDuplicatable
- Returns:
- duplicate
-
getId
public java.lang.String getId()
Description copied from interface:Persistable
Get id identifying object.- Specified by:
getId
in interfacePersistable
- Returns:
- id
-
getType
public java.lang.String getType()
Description copied from interface:Persistable
Get type (XML element name / database table name not Java class name).- Specified by:
getType
in interfacePersistable
- Returns:
- type
-
getAttributes
public NameValuePairList getAttributes()
Description copied from interface:Persistable
Get all single value fields.- Specified by:
getAttributes
in interfacePersistable
- Returns:
- name value pair list
-
getChildren
public java.util.List<java.util.List<Persistable>> getChildren()
Description copied from interface:Persistable
Get all multi value fields.- Specified by:
getChildren
in interfacePersistable
- Returns:
- list of list of persistable objects
-
setAttributes
public void setAttributes(NameValuePairList attr) throws ModelException
Description copied from interface:Persistable
Set all single value fields.- Specified by:
setAttributes
in interfacePersistable
- Parameters:
attr
- value pair list- Throws:
ModelException
- if problems
-
setChildren
public void setChildren(java.util.List<java.util.List<Persistable>> childs)
Description copied from interface:Persistable
Set all multi value fields.- Specified by:
setChildren
in interfacePersistable
- Parameters:
childs
- list of list of persistable objects
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-