org.haphazard.item
Interface Containing

All Known Implementing Classes:
Container, Inventory, Item

public interface Containing


Method Summary
 boolean add(Item item)
          Adds an item to this container
 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
 

Method Detail

getContainerDimension

public Dimension3D getContainerDimension()
Gets the total volume of the container

Returns:
The total volume of the container

getFreeSpecializationSlots

public int getFreeSpecializationSlots()
Gets the number of free slots

Returns:
Gets the number of free specialization slots on this container

isSpecialization

public boolean isSpecialization(Item item)
Checks if an item is a specialization of this container

Parameters:
item - The item to check

contains

public boolean contains(Item item)
Checks if this container contains this item

Parameters:
item - The item to check for
Returns:
True if the item is in this container

add

public boolean add(Item item)
Adds an item to this container

Parameters:
item - The item to add
Returns:
True if the the add went ok

remove

public boolean remove(Item item)
Removes an item from this container

Parameters:
item - The item to remove
Returns:
True if the remove went ok

canHold

public boolean canHold(Item item)
Checks if this container can hold the specified item

Parameters:
item - The item to check against
Returns:
True if the container can hold the item

getFreeVolume

public int getFreeVolume()
Gets the total free volume of the inventory

Returns:
The total free volume of the inventory in cm3

getContainerWeight

public int getContainerWeight()
Gets the total weight of the container

Returns:
The total weight of the container in grams

getTreeNode

public javax.swing.tree.DefaultMutableTreeNode getTreeNode()
Gets the treenode of the containing item

Returns:
The node of the container to be used in a JTree