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

## com.huguesjohnson.tiamat
Class Item

    java.lang.Object
      com.huguesjohnson.tiamat.NamedObject
          com.huguesjohnson.tiamat.Item

All Implemented Interfaces:
  Storable

    public class Item

extends NamedObject
implements Storable

Item - representation of an item

Author:
  Hugues Johnson

Field Summary
`static boolean` | `DEFAULT_DISAPPEAR_ON_USE` default value for disappearOnUse property
`static boolean` | `DEFAULT_EQUIPABLE` default value for equipable property
`static boolean` | `DEFAULT_EQUIPPED` default value for equipped property

Constructor Summary
`Item()` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, boolean equipable, boolean disappearOnUse, boolean equipped)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable, boolean disappearOnUse)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable, boolean disappearOnUse, boolean equipped)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, Target[] targets)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable, boolean disappearOnUse)` Creates a new instance of Item.
`Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable, boolean disappearOnUse, boolean equipped)` Creates a new instance of Item.

Method Summary
`void` | `addTarget(Target target)` Adds a Target to the collection of Targets
`boolean` | `getDisappearOnUse()` Returns whether this Item should disappear after being used.
`boolean` | `getEquipable()` Returns whether this Item can be equipped.
`boolean` | `getEquipped()` Returns whether this Item is currently equipped.
`java.awt.image.BufferedImage` | `getFullImage()` Returns the full-size image for this item, change by setting fullImagePath.
`java.lang.String` | `getFullImagePath()` Returns the relative path to full-size image for this Item.
`java.lang.String` | `getFullImagePathAbsolute()` Returns the absolute path to full-size image for this Item.
`Target` | `getTarget(int index)` Returns the Target at the specified index.
`int` | `getTargetCount()` Returns the number of targets for this item.
`Target[]` | `getTargets()` Returns the Targets for this Item.
`java.awt.image.BufferedImage` | `getThumbnailImage()` Returns the thumbnail image for this Item, what would appear in a menu or dialog, change by setting thumbnailImagePath.
`java.lang.String` | `getThumbnailImagePath()` Returns the relative path to thumbnail image for this Item.
`java.lang.String` | `getThumbnailImagePathAbsolute()` Returns the absolute path to thumbnail image for this Item.
`void` | `onDeserialize(Formatter formatter, java.lang.String absoluteDir)` The onDeserialize event should be fired after an object is de-serialized.
`void` | `setAbsoluteDir(java.lang.String absoluteDir)` Sets the absolute working directory for files.
`void` | `setDisappearOnUse(boolean disappearOnUse)` Sets whether this Item should disappear after being used.
`void` | `setEquipable(boolean equipable)` Sets whether this Item can be equipped.
`void` | `setEquipped(boolean equipped)` Sets whether this Item is currently equipped.
`void` | `setFullImagePath(java.lang.String fullImagePath)` Sets the relative path to full-size image for this Item, setting this reloads the actual image.
`void` | `setTarget(int index, Target target)` Sets the Target at the specified index.
`void` | `setTargets(Target[] targets)` Set the Targets for this Item.
`void` | `setThumbnailImagePath(java.lang.String thumbnailImagePath)` Sets the relative path to thumbnail image for this Item, what would appear in a menu or dialog, setting this reloads the actual image.
`java.lang.String` | `toString()` Returns a string representation of the object.

Methods inherited from class com.huguesjohnson.tiamat.NamedObject
`getDescription, getName, setDescription, setName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_EQUIPPED

    public static final boolean DEFAULT_EQUIPPED

  default value for equipped property

  See Also:
    Constant Field Values

### DEFAULT_EQUIPABLE

    public static final boolean DEFAULT_EQUIPABLE

  default value for equipable property

  See Also:
    Constant Field Values

### DEFAULT_DISAPPEAR_ON_USE

    public static final boolean DEFAULT_DISAPPEAR_ON_USE

  default value for disappearOnUse property

  See Also:
    Constant Field Values

Constructor Detail

### Item

    public Item()

  Creates a new instance of Item.

### Item

    public Item(java.lang.String name,
                java.lang.String description)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                Target[] targets)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                Target[] targets,
                boolean equipable)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                Target[] targets,
                boolean equipable,
                boolean disappearOnUse)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.
    `disappearOnUse` - Whether this Item should disappear after being used.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                Target[] targets,
                boolean equipable,
                boolean disappearOnUse,
                boolean equipped)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.
    `disappearOnUse` - Whether this Item should disappear after being used.
    `equipped` - Whether this Item is equipped.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath,
                Target[] targets,
                boolean equipable,
                boolean disappearOnUse,
                boolean equipped)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.
    `disappearOnUse` - Whether this Item should disappear after being used.
    `equipped` - Whether this Item is equipped.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `fullImagePath` - The relative path to full-size image for this Item.
    `thumbnailImagePath` - The relative path to thumbnail image for this Item.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath,
                Target[] targets)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `fullImagePath` - The relative path to full-size image for this Item.
    `thumbnailImagePath` - The relative path to thumbnail image for this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath,
                Target[] targets,
                boolean equipable)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `fullImagePath` - The relative path to full-size image for this Item.
    `thumbnailImagePath` - The relative path to thumbnail image for this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath,
                Target[] targets,
                boolean equipable,
                boolean disappearOnUse)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `fullImagePath` - The relative path to full-size image for this Item.
    `thumbnailImagePath` - The relative path to thumbnail image for this Item.
    `targets` - The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.
    `equipable` - Whether this Item can be equipped.
    `disappearOnUse` - Whether this Item should disappear after being used.

### Item

    public Item(java.lang.String name,
                java.lang.String description,
                java.lang.String absoluteDir,
                java.lang.String fullImagePath,
                java.lang.String thumbnailImagePath,
                boolean equipable,
                boolean disappearOnUse,
                boolean equipped)

  Creates a new instance of Item.

  Parameters:
    `name` - The name of this Item.
    `description` - The description of this Item.
    `absoluteDir` - The full path to the working directory.
    `fullImagePath` - The relative path to full-size image for this Item.
    `thumbnailImagePath` - The relative path to thumbnail image for this Item.
    `equipable` - Whether this Item can be equipped.
    `disappearOnUse` - Whether this Item should disappear after being used.
    `equipped` - Whether this Item is equipped.

Method Detail

### setFullImagePath

    public void setFullImagePath(java.lang.String fullImagePath)

  Sets the relative path to full-size image for this Item, setting this reloads the actual image.

  Parameters:
    `fullImagePath` - The relative path to full-size image for this Item.

### getFullImagePath

    public java.lang.String getFullImagePath()

  Returns the relative path to full-size image for this Item.

  Returns:
    The relative path to full-size image for this Item.

### getFullImagePathAbsolute

    public java.lang.String getFullImagePathAbsolute()

  Returns the absolute path to full-size image for this Item.

  Returns:
    The absolute path to full-size image for this Item.

### getFullImage

    public java.awt.image.BufferedImage getFullImage()

  Returns the full-size image for this item, change by setting fullImagePath.

  Returns:
    The full-size image for this item.

### getThumbnailImage

    public java.awt.image.BufferedImage getThumbnailImage()

  Returns the thumbnail image for this Item, what would appear in a menu or dialog, change by setting thumbnailImagePath.

  Returns:
    The thumbnail image for this Item.

### setThumbnailImagePath

    public void setThumbnailImagePath(java.lang.String thumbnailImagePath)

  Sets the relative path to thumbnail image for this Item, what would appear in a menu or dialog, setting this reloads the actual image.

  Parameters:
    `thumbnailImagePath` - The relative path to thumbnail image for this Item, setting this reloads the actual image

### getThumbnailImagePath

    public java.lang.String getThumbnailImagePath()

  Returns the relative path to thumbnail image for this Item.

  Returns:
    The relative path to thumbnail image for this Item.

### getThumbnailImagePathAbsolute

    public java.lang.String getThumbnailImagePathAbsolute()

  Returns the absolute path to thumbnail image for this Item.

  Returns:
    The absolute path to thumbnail image for this Item.

### setTargets

    public void setTargets(Target[] targets)

  Set the Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.

  Parameters:
    `targets` - The Targets for this Item.

### getTargets

    public Target[] getTargets()

  Returns the Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.

  Returns:
    The Targets for this Item.

### setTarget

    public void setTarget(int index,
                          Target target)

  Sets the Target at the specified index.

  Parameters:
    `index` - The index to set at.
    `target` - The Target to set.

### getTarget

    public Target getTarget(int index)

  Returns the Target at the specified index.

  Parameters:
    `index` - The index to retrieve.
  Returns:
    The Target at the specified index, null if index is out of range.

### setEquipped

    public void setEquipped(boolean equipped)

  Sets whether this Item is currently equipped.

  Parameters:
    `equipped` - Whether this Item is currently equipped.

### getEquipped

    public boolean getEquipped()

  Returns whether this Item is currently equipped.

  Returns:
    True if the Item is equipped, false if it is not.

### setEquipable

    public void setEquipable(boolean equipable)

  Sets whether this Item can be equipped.

  Parameters:
    `equipable` - Whether this Item can be equipped.

### getEquipable

    public boolean getEquipable()

  Returns whether this Item can be equipped.

  Returns:
    True if the Item can be equipped, false if it can not.

### setDisappearOnUse

    public void setDisappearOnUse(boolean disappearOnUse)

  Sets whether this Item should disappear after being used.

  Parameters:
    `disappearOnUse` - Whether this Item should disappear after being used.

### getDisappearOnUse

    public boolean getDisappearOnUse()

  Returns whether this Item should disappear after being used.

  Returns:
    True if the Item should disappear after being used.

### setAbsoluteDir

    public void setAbsoluteDir(java.lang.String absoluteDir)

  Sets the absolute working directory for files.

  Parameters:
    `absoluteDir` - The full path to the working directory.

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Overrides:
    `toString` in class `NamedObject`
  Returns:
    A string representation of the object.

### getTargetCount

    public int getTargetCount()

  Returns the number of targets for this item.

  Returns:
    The number of targets for this item.

### addTarget

    public void addTarget(Target target)

  Adds a Target to the collection of Targets

  Parameters:
    `target` - The Target to add.

### onDeserialize

    public void onDeserialize(Formatter formatter,
                              java.lang.String absoluteDir)

  The onDeserialize event should be fired after an object is de-serialized. This allows objects to load transient members, set their working directory, and load Storable members if needed.

  Specified by:
    `onDeserialize` in interface `Storable`
  Overrides:
    `onDeserialize` in class `NamedObject`
  Parameters:
    `formatter` - the formatter to use to load any storable members
    `absoluteDir` - the working directory since all paths stored in the object should be relative

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

Copyright © 2004-2006 Hugues Johnson