com.huguesjohnson.tiamat
Class ItemCollection

java.lang.Object
  extended bycom.huguesjohnson.tiamat.ItemCollection

public class ItemCollection
extends java.lang.Object

ItemCollection - used to store a collection of items

Author:
Hugues Johnson

Constructor Summary
ItemCollection()
           
ItemCollection(Item[] items)
           
ItemCollection(Item[] items, java.lang.String pathDelimiter)
           
ItemCollection(java.lang.String pathDelimiter)
           
 
Method Summary
 Item[] getAll()
          return all Items in the collection
 int getCount()
          returns the total number of Items in the collection
 int getCount(java.lang.String path)
          returns the total number of Items starting from the path
 Item getItem(java.lang.String path)
          return the Item with that name if it exists, otherwise null
 Item[] getModifiersFor(java.lang.String targetPath)
          return an array of all equipped Items that have a target with a targetName equal to targetPath
 int getNetModification(java.lang.String targetPath)
          use getModifiersFor() to get all the modifiers for a target, return the sum of their values
 boolean removeItem(java.lang.String path)
          return success
 void setItem(java.lang.String path, Item item)
          sets the Item with the given path, adds it if it doesn’t exist
 java.lang.String toString()
          returns a string representation of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ItemCollection

public ItemCollection()

ItemCollection

public ItemCollection(java.lang.String pathDelimiter)

ItemCollection

public ItemCollection(Item[] items)

ItemCollection

public ItemCollection(Item[] items,
                      java.lang.String pathDelimiter)
Method Detail

removeItem

public boolean removeItem(java.lang.String path)
return success


getItem

public Item getItem(java.lang.String path)
return the Item with that name if it exists, otherwise null


setItem

public void setItem(java.lang.String path,
                    Item item)
sets the Item with the given path, adds it if it doesn’t exist


getCount

public int getCount()
returns the total number of Items in the collection


getCount

public int getCount(java.lang.String path)
returns the total number of Items starting from the path


getModifiersFor

public Item[] getModifiersFor(java.lang.String targetPath)
return an array of all equipped Items that have a target with a targetName equal to targetPath


getNetModification

public int getNetModification(java.lang.String targetPath)
use getModifiersFor() to get all the modifiers for a target, return the sum of their values


getAll

public Item[] getAll()
return all Items in the collection


toString

public java.lang.String toString()
returns a string representation of the object