net.sf.freecol.common.model
Class GoodsTradeItem

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.TradeItem
          extended by net.sf.freecol.common.model.GoodsTradeItem

public class GoodsTradeItem
extends TradeItem


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
GoodsTradeItem(Game game, Player source, Player destination, Goods goods, Settlement settlement)
          Creates a new GoodsTradeItem instance.
GoodsTradeItem(Game game, javax.xml.stream.XMLStreamReader in)
          Creates a new GoodsTradeItem instance.
 
Method Summary
 Goods getGoods()
          Get the Goods value.
 Settlement getSettlement()
          Get the Settlement value.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 boolean isUnique()
          Returns whether this TradeItem must be unique.
 boolean isValid()
          Returns whether this TradeItem is valid.
 java.util.List<FreeColGameObject> makeTrade()
          Concludes the trade.
 void setGoods(Goods newGoods)
          Set the Goods value.
 void setSettlement(Settlement newSettlement)
          Set the Settlement value.
 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.TradeItem
getDestination, getGame, getSource, setDestination, setGame, setSource
 
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, toString, wait, wait, wait
 

Constructor Detail

GoodsTradeItem

public GoodsTradeItem(Game game,
                      Player source,
                      Player destination,
                      Goods goods,
                      Settlement settlement)
Creates a new GoodsTradeItem instance.

Parameters:
game - a Game value
source - a Player value
destination - a Player value
goods - a Goods value
settlement - a Settlement value

GoodsTradeItem

public GoodsTradeItem(Game game,
                      javax.xml.stream.XMLStreamReader in)
               throws javax.xml.stream.XMLStreamException
Creates a new GoodsTradeItem instance.

Parameters:
game - a Game value
in - a XMLStreamReader value
Throws:
javax.xml.stream.XMLStreamException
Method Detail

getGoods

public final Goods getGoods()
Get the Goods value.

Returns:
a Goods value

setGoods

public final void setGoods(Goods newGoods)
Set the Goods value.

Parameters:
newGoods - The new Goods value.

getSettlement

public final Settlement getSettlement()
Get the Settlement value.

Returns:
a Settlement value

setSettlement

public final void setSettlement(Settlement newSettlement)
Set the Settlement value.

Parameters:
newSettlement - The new Settlement value.

isValid

public boolean isValid()
Returns whether this TradeItem is valid.

Specified by:
isValid in class TradeItem
Returns:
a boolean value

isUnique

public boolean isUnique()
Returns whether this TradeItem must be unique. This is true for the StanceTradeItem and the GoldTradeItem, and false for all others.

Specified by:
isUnique in class TradeItem
Returns:
a boolean value

makeTrade

public java.util.List<FreeColGameObject> makeTrade()
Concludes the trade.

Specified by:
makeTrade in class TradeItem
Returns:
An item to be updated, or null if none required.

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.

Overrides:
toXMLImpl in class TradeItem
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:
"goods".