net.sf.freecol.common.model
Class StanceTradeItem

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.StanceTradeItem

public class StanceTradeItem
extends TradeItem


Field Summary
private  Player.Stance stance
          The stance between source and destination.
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE
 
Constructor Summary
StanceTradeItem(Game game, Player source, Player destination, Player.Stance stance)
          Creates a new StanceTradeItem instance.
StanceTradeItem(Game game, javax.xml.stream.XMLStreamReader in)
          Creates a new StanceTradeItem instance.
 
Method Summary
 Player.Stance getStance()
          Get the Stance 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.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setStance(Player.Stance newStance)
          Set the Stance 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, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, setId, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stance

private Player.Stance stance
The stance between source and destination.

Constructor Detail

StanceTradeItem

public StanceTradeItem(Game game,
                       Player source,
                       Player destination,
                       Player.Stance stance)
Creates a new StanceTradeItem instance.

Parameters:
game - a Game value
source - a Player value
destination - a Player value
stance - an Stance value

StanceTradeItem

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

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

getStance

public final Player.Stance getStance()
Get the Stance value.

Returns:
an Stance value

setStance

public final void setStance(Player.Stance newStance)
Set the Stance value.

Parameters:
newStance - The new Stance 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.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Overrides:
readFromXMLImpl in class TradeItem
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

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".