rle.core.board.item
Class Inventory

java.lang.Object
  extended by rle.core.vm.PlugInBase
      extended by rle.core.board.item.ItemContainerBase
          extended by rle.core.board.item.Inventory
All Implemented Interfaces:
ItemContainer, PlugIn

public class Inventory
extends ItemContainerBase

Basic implementation of ItemContainer. This implementation accepts all unique items and maintains no internal sequence of items or item slots.


Field Summary
protected  java.util.TreeSet<Item> items
           
 
Fields inherited from class rle.core.vm.PlugInBase
config, context, parameters
 
Constructor Summary
Inventory()
           
 
Method Summary
 void add(Item item)
          Attempts to add item.
 boolean canAdd(Item item)
          Tests whether an Item can be added.
 Item first()
           
 java.util.Set<Item> items()
          All items contained.
 void remove(Item item)
          Removes item.
 
Methods inherited from class rle.core.board.item.ItemContainerBase
addItemContainerListener, fireItemAdded, fireItemRemoved, isEmpty, removeItemContainerListener
 
Methods inherited from class rle.core.vm.PlugInBase
config, getContext, getParameters, paramMap, setConfig, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rle.core.vm.PlugIn
config, getContext, paramMap, setConfig, setParameters
 

Field Detail

items

protected java.util.TreeSet<Item> items
Constructor Detail

Inventory

public Inventory()
Method Detail

items

public java.util.Set<Item> items()
All items contained.


first

public Item first()

canAdd

public boolean canAdd(Item item)
Tests whether an Item can be added.


add

public void add(Item item)
Attempts to add item. If canAdd() is false, will throw an IllegalArgumentException.


remove

public void remove(Item item)
Removes item.