|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.haphazard.character.inventory.Inventory
Convenience class for handling the inventory
Constructor Summary | |
Inventory()
Creates a new instance of Inventory |
Method Summary | |
boolean |
add(Item item)
Adds an item to this container |
void |
addContainer(Containing container)
Adds a container to the inventory |
boolean |
canHold(Item item)
Checks if this container can hold the specified item |
boolean |
contains(Item item)
Checks if this container contains this item |
Dimension3D |
getContainerDimension()
Gets the total volume of the container |
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 |
removeContainer(Containing container)
Removes a container to the inventory |
void |
setAlgorithm(InventoryAlgorithm algorithm)
Sets the algorithm to be used for this inventory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Inventory()
Method Detail |
public void setAlgorithm(InventoryAlgorithm algorithm)
algorithm
- The algorithm to usepublic boolean add(Item item)
add
in interface Containing
item
- The item to add
public void addContainer(Containing container)
container
- The container to addpublic boolean remove(Item item)
remove
in interface Containing
item
- The item to remove
public void removeContainer(Containing container)
container
- The container to removepublic boolean canHold(Item item)
canHold
in interface Containing
item
- The item to check against
public boolean contains(Item item)
contains
in interface Containing
item
- The item to check for
public Dimension3D getContainerDimension()
getContainerDimension
in interface Containing
public int getFreeVolume()
getFreeVolume
in interface Containing
public int getContainerWeight()
getContainerWeight
in interface Containing
public javax.swing.tree.DefaultMutableTreeNode getTreeNode()
getTreeNode
in interface Containing
public int getFreeSpecializationSlots()
Containing
getFreeSpecializationSlots
in interface Containing
public boolean isSpecialization(Item item)
Containing
isSpecialization
in interface Containing
item
- The item to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |