com.eoi.freya.game
Class Item
java.lang.Object
|
+--com.eoi.freya.game.Item
- public class Item
- extends java.lang.Object
An Item wraps up an Element that contains data to describe generic items.
Each item has a 'TYPE' and a 'VALUE', which is usually used to represent quantity.
Constructor Summary |
Item()
Construct an empty Item object with no contents for the TYPE and VALUE tags |
Item(org.jdom.Element value)
Construct and item using an existing XML Element |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Item
public Item()
- Construct an empty Item object with no contents for the TYPE and VALUE tags
Item
public Item(org.jdom.Element value)
- Construct and item using an existing XML Element
- Parameters:
value
- The Element to use.
getType
public java.lang.String getType()
- Returns:
- The String value of the type of the item.
setType
public void setType(java.lang.String newType)
- Parameters:
newType
- Set the type of this item.
getValue
public int getValue()
- Returns:
- the int quantity of the item .
setValue
public void setValue(int value)
- Parameters:
value
- Set int quantity of the item.
setValue
public void setValue(java.lang.String value)
- Parameters:
value
- Set the String quantity of the item.
add
public void add(int addValue)
- Parameters:
addValue
- add a quantity to the current value
subtract
public void subtract(int subValue)
- Parameters:
subValue
- the int value to subtract from the current amount
getElement
public org.jdom.Element getElement()
- Returns:
- the XML Element of this Item
setElement
public void setElement(org.jdom.Element value)
- Parameters:
value
-
Freya Engine, The Turn Based Game Engine
Copyright(c) 2002 Alexander Bilton
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA