net.sf.freecol.common.model
Class AbstractGoods

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.AbstractGoods
Direct Known Subclasses:
Goods

public class AbstractGoods
extends FreeColObject

Represents a certain amount of a GoodsType. It does not correspond to actual cargo present in a Location. It is intended to represent things such as the amount of Lumber necessary to build something, or the amount of cargo to load at a certain Location.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
AbstractGoods()
          Creates a new AbstractGoods instance.
AbstractGoods(GoodsType type, int amount)
          Creates a new AbstractGoods instance.
 
Method Summary
 int getAmount()
          Get the Amount value.
 GoodsType getType()
          Get the Type value.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 void setAmount(int newAmount)
          Set the Amount value.
 void setType(GoodsType newType)
          Set the Type value.
 java.lang.String toString()
           
 void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readFromXML, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractGoods

public AbstractGoods()
Creates a new AbstractGoods instance.


AbstractGoods

public AbstractGoods(GoodsType type,
                     int amount)
Creates a new AbstractGoods instance.

Parameters:
type - a GoodsType value
amount - an int value
Method Detail

getType

public final GoodsType getType()
Get the Type value.

Returns:
a GoodsType value

setType

public final void setType(GoodsType newType)
Set the Type value.

Parameters:
newType - The new Type value.

getAmount

public final int getAmount()
Get the Amount value.

Returns:
an int value

setAmount

public final void setAmount(int newAmount)
Set the Amount value.

Parameters:
newAmount - The new Amount value.

toXMLImpl

public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
               throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"abstractGoods".

toString

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