org.haphazard.character.inventory
Class BestFit

java.lang.Object
  extended byorg.haphazard.character.inventory.BestFit
All Implemented Interfaces:
InventoryAlgorithm

public class BestFit
extends java.lang.Object
implements InventoryAlgorithm

Algorithm that puts an item into the best container with no rearranging


Constructor Summary
BestFit()
          Creates a new instance of BestFit
 
Method Summary
 boolean add(Item item, java.util.Vector containers)
          Adds an item to a container
 boolean canHold(Item item, java.util.Vector containers)
          Checks if the specified containers can hold the specified item
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BestFit

public BestFit()
Creates a new instance of BestFit

Method Detail

add

public boolean add(Item item,
                   java.util.Vector containers)
Adds an item to a container

Specified by:
add in interface InventoryAlgorithm
Parameters:
item - The item to add
containers - The number of containers to use for adding
Returns:
True if the item could be fit

canHold

public boolean canHold(Item item,
                       java.util.Vector containers)
Checks if the specified containers can hold the specified item

Specified by:
canHold in interface InventoryAlgorithm
Parameters:
item - The item to hold
containers - The containers to use to store the item
Returns:
True if the containers can hold the item