es.ucm.fdi.hysteria.game
Class Item

java.lang.Object
  extended by es.ucm.fdi.hysteria.game.Item
All Implemented Interfaces:
java.io.Serializable

public class Item
extends java.lang.Object
implements java.io.Serializable

This class represents the items that can appear in the rooms. An item has a name, a description and a value. An item is contained in a room. When the player picks an item, it is stored in the player inventory. When the player drops an item, it appears in the current room.

Author:
Sandor
See Also:
Serialized Form

Field Summary
protected  java.lang.String _desc
          Item description.
protected  boolean _extinguishes
           
protected  java.util.Hashtable<Item,java.lang.Boolean> _extinguishesWith
           
protected  java.lang.String _image
           
protected  int _lightLevel
           
protected  java.util.Hashtable<Item,java.util.LinkedHashSet<Item>> _morphs
           
protected  java.util.LinkedHashSet<Item> _morphsInto
           
protected  java.lang.String _name
          The item name.
protected  int _value
          The item value
protected  float _weight
          The item weight
 
Constructor Summary
Item(java.lang.String name, java.lang.String desc, int value)
          Item constructor, specifying the name of the item, its description and its value
Item(java.lang.String name, java.lang.String desc, int value, float weight)
           
Item(java.lang.String name, java.lang.String desc, int value, float weight, java.lang.String image)
           
Item(java.lang.String name, java.lang.String desc, int value, int lightLevel)
           
Item(java.lang.String name, java.lang.String desc, int value, int lightLevel, float weight)
           
Item(java.lang.String name, java.lang.String desc, int value, int lightLevel, float weight, java.lang.String image)
           
Item(java.lang.String name, java.lang.String desc, int value, int lightLevel, java.lang.String image)
           
Item(java.lang.String name, java.lang.String desc, int value, java.lang.String image)
           
 
Method Summary
 boolean extinguishAfterUse()
           
 boolean extinguishAfterUseWith(Item reactive)
           
 java.lang.String getDescription()
          Returns the item description
 java.lang.String getImagePath()
           
 int getLightLevel()
           
 java.lang.String getName()
          Returns the item name
 java.util.Set<Item> getUsedItem()
           
 java.util.Set<Item> getUsedItemWith(Item i)
           
 int getValue()
          Returns the item value
 float getWeight()
          Returns the item weight
 boolean isLightLevelGreaterThan(int i)
           
 boolean isUsable()
           
 boolean isUsableWith(Item i)
           
 void setUsable(Item i)
           
 void setUsable(Item i, boolean extinguish)
           
 void setUsableWith(Item reactive, Item product)
           
 void setUsableWith(Item reactive, Item product, boolean extinguishes)
           
 void setUsableWith(Item reactive, Item product, boolean extinguishes, boolean extinguish_reactive)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_desc

protected java.lang.String _desc
Item description.


_name

protected java.lang.String _name
The item name. It identifies the item.


_value

protected int _value
The item value


_weight

protected float _weight
The item weight


_image

protected java.lang.String _image

_extinguishes

protected boolean _extinguishes

_morphsInto

protected java.util.LinkedHashSet<Item> _morphsInto

_morphs

protected java.util.Hashtable<Item,java.util.LinkedHashSet<Item>> _morphs

_extinguishesWith

protected java.util.Hashtable<Item,java.lang.Boolean> _extinguishesWith

_lightLevel

protected int _lightLevel
Constructor Detail

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value)
     throws java.lang.IllegalArgumentException
Item constructor, specifying the name of the item, its description and its value

Parameters:
name - Item name
desc - Item description
value - Item value
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            float weight)
     throws java.lang.IllegalArgumentException
Parameters:
name -
desc -
value -
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            int lightLevel)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            int lightLevel,
            float weight)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            java.lang.String image)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            int lightLevel,
            java.lang.String image)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            float weight,
            java.lang.String image)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Item

public Item(java.lang.String name,
            java.lang.String desc,
            int value,
            int lightLevel,
            float weight,
            java.lang.String image)
     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

getDescription

public java.lang.String getDescription()
Returns the item description

Returns:
The item description

getValue

public int getValue()
Returns the item value

Returns:
The item value

getName

public java.lang.String getName()
Returns the item name

Returns:
The item name

getWeight

public float getWeight()
Returns the item weight

Returns:
The item weight

getLightLevel

public int getLightLevel()

isLightLevelGreaterThan

public boolean isLightLevelGreaterThan(int i)

getImagePath

public java.lang.String getImagePath()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isUsable

public boolean isUsable()

getUsedItem

public java.util.Set<Item> getUsedItem()

isUsableWith

public boolean isUsableWith(Item i)

getUsedItemWith

public java.util.Set<Item> getUsedItemWith(Item i)

setUsable

public void setUsable(Item i)

setUsable

public void setUsable(Item i,
                      boolean extinguish)

setUsableWith

public void setUsableWith(Item reactive,
                          Item product)

setUsableWith

public void setUsableWith(Item reactive,
                          Item product,
                          boolean extinguishes)

setUsableWith

public void setUsableWith(Item reactive,
                          Item product,
                          boolean extinguishes,
                          boolean extinguish_reactive)

extinguishAfterUse

public boolean extinguishAfterUse()

extinguishAfterUseWith

public boolean extinguishAfterUseWith(Item reactive)