|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.haphazard.item.Container
Class for holding items and keeping track of free space for more items
Constructor Summary | |
Container()
Creates a new container |
Method Summary | |
boolean |
add(Item item)
Adds an item to this container |
void |
addSpecialization(java.lang.String specialization)
Adds an item specialization to this container. |
boolean |
canHold(Item item)
Checks if this container can hold the item in question |
boolean |
contains(Item item)
Checks if this container contains a specific item |
Dimension3D |
getContainerDimension()
Returns the containers volume |
int |
getContainerWeight()
Gets the total weight of the container |
int |
getFreeSpecializationSlots()
Gets the number of free slots |
int |
getFreeVolume()
Gets the total free volume of the inventory |
javax.swing.tree.DefaultMutableTreeNode |
getTreeNode()
Gets the treenode of the containing item |
boolean |
isSpecialization(Item item)
Checks if an item is a specialization of this container |
boolean |
remove(Item item)
Removes an item from this container |
void |
setContainerDimension(Dimension3D dimension)
Sets the dimension of the container |
void |
setSpecializations(java.util.Vector specializations)
Convenience function for setting all specializations at once |
void |
setSpecializationSlots(int count)
Sets the number of specialized items the container can hold |
java.lang.String |
toXML(int indent)
Transforms this object into an XML notation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Container()
Method Detail |
public Dimension3D getContainerDimension()
getContainerDimension
in interface Containing
public void setContainerDimension(Dimension3D dimension)
dimension
- The dimension of the containerpublic void addSpecialization(java.lang.String specialization)
specialization
- The type of item to specialize inpublic void setSpecializations(java.util.Vector specializations)
specializations
- All specializations for this containerpublic void setSpecializationSlots(int count)
count
- The number of specialized items the container can holdpublic int getFreeSpecializationSlots()
getFreeSpecializationSlots
in interface Containing
public boolean contains(Item item)
contains
in interface Containing
item
- The item to look for
public boolean add(Item item)
add
in interface Containing
item
- The item to add
public boolean remove(Item item)
remove
in interface Containing
item
- The item to remove
public boolean canHold(Item item)
canHold
in interface Containing
item
- The item to check
public int getFreeVolume()
getFreeVolume
in interface Containing
public int getContainerWeight()
getContainerWeight
in interface Containing
public java.lang.String toXML(int indent)
indent
- The indent level
public boolean isSpecialization(Item item)
isSpecialization
in interface Containing
item
- The item to checkpublic javax.swing.tree.DefaultMutableTreeNode getTreeNode()
getTreeNode
in interface Containing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |