Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.huguesjohnson.tiamat
Class ItemCollection

    java.lang.Object
      com.huguesjohnson.tiamat.ItemCollection

    public class ItemCollection

extends java.lang.Object

ItemCollection - used to store a collection of items

Author:
  Hugues Johnson

Constructor Summary
`ItemCollection()` Default constructor, uses default pathDelimiter.
`ItemCollection(Item[] items)` Create a new ItemCollection based off an array of Items with a the default path delimiter.
`ItemCollection(Item[] items, java.lang.String pathDelimiter)` Create a new ItemCollection based off an array of Items with a the default path delimiter.
`ItemCollection(java.lang.String pathDelimiter)` Create a new ItemCollection with a custom path delimiter.

Method Summary
`Item[]` | `getAll()` Returns 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 specified path.
`Item` | `getItem(java.lang.String path)` Returns the Item with the specified path if it exists, otherwise null.
`ItemCollection` | `getModifiersFor(java.lang.String targetPath)` Returns a collection of all equipped Items that have a target with a name equal to targetPath.
`int` | `getNetModification(java.lang.String targetPath)` This method is used to get all the modifiers for a target and return the sum of their values.
`boolean` | `removeItem(java.lang.String path)` Removes the Item with the specified path.
`void` | `setItem(java.lang.String path, Item item)` Sets the Item with the specified 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()

  Default constructor, uses default pathDelimiter.

### ItemCollection

    public ItemCollection(java.lang.String pathDelimiter)

  Create a new ItemCollection with a custom path delimiter.

  Parameters:
    `pathDelimiter` - The new path delimiter to use.

### ItemCollection

    public ItemCollection(Item[] items)

  Create a new ItemCollection based off an array of Items with a the default path delimiter.

  Parameters:
    `items` - The initial set of items to add to the collection.

### ItemCollection

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

  Create a new ItemCollection based off an array of Items with a the default path delimiter.

  Parameters:
    `items` - The initial set of Items to add to the collection.
    `pathDelimiter` - The new path delimiter to use.

Method Detail

### removeItem

    public boolean removeItem(java.lang.String path)

  Removes the Item with the specified path.

  Parameters:
    `path` - The path of the Item to remove.
  Returns:
    The success of the operation.

### getItem

    public Item getItem(java.lang.String path)

  Returns the Item with the specified path if it exists, otherwise null.

  Parameters:
    `path` - The path of the Item to retreive.
  Returns:
    The Item with the specified path if it exists, otherwise null.

### setItem

    public void setItem(java.lang.String path,
                        Item item)

  Sets the Item with the specified path, adds it if it doesn't exist.

  Parameters:
    `path` - The path of the Item to set.
    `item` - The Item to set.

### getCount

    public int getCount()

  Returns the total number of Items in the collection.

  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 specified path.

  Parameters:
    `path` - The starting path to count from.
  Returns:
    The total number of Items starting from the specified path.

### getModifiersFor

    public ItemCollection getModifiersFor(java.lang.String targetPath)

  Returns a collection of all equipped Items that have a target with a name equal to targetPath.

  Parameters:
    `targetPath` - The target name to look for.
  Returns:
    A collection of all equipped Items that have a target with a name equal to targetPath.

### getNetModification

    public int getNetModification(java.lang.String targetPath)

  This method is used to get all the modifiers for a target and return the sum of their values.

  Parameters:
    `targetPath` - The target name to look for.
  Returns:
    The sum of modifiers for a target.

### getAll

    public Item[] getAll()

  Returns all Items in the collection.

  Returns:
    All Items in the collection.

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A string representation of the object.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD