|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.DiplomaticTrade
public class DiplomaticTrade
The class DiplomaticTrade represents an offer one player can
make another.
| Nested Class Summary | |
|---|---|
static class |
DiplomaticTrade.TradeStatus
A type for the trade status. |
| Field Summary | |
|---|---|
private Game |
game
|
private java.util.List<TradeItem> |
items
The individual items the trade consists of. |
private Player |
recipient
The player who is to accept this agreement. |
private Player |
sender
The player who proposed agreement. |
private DiplomaticTrade.TradeStatus |
status
The status of this agreement. |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
DiplomaticTrade(Game game,
org.w3c.dom.Element element)
Creates a new DiplomaticTrade instance. |
|
DiplomaticTrade(Game game,
Player sender,
Player recipient)
Creates a new DiplomaticTrade instance. |
|
DiplomaticTrade(Game game,
Player sender,
Player recipient,
java.util.List<TradeItem> items)
Creates a new DiplomaticTrade instance. |
|
| Method Summary | |
|---|---|
void |
add(TradeItem newItem)
Add to the DiplomaticTrade. |
java.util.List<Colony> |
getColoniesGivenBy(Player player)
Get a list of colonies offered in this trade. |
java.util.List<Goods> |
getGoodsGivenBy(Player player)
Get the goods being offered. |
Player |
getRecipient()
Get the recipient player. |
Player |
getSender()
Get the sending player. |
Player.Stance |
getStance()
Get the stance being offered. |
DiplomaticTrade.TradeStatus |
getStatus()
Get the trade status. |
java.util.List<TradeItem> |
getTradeItems()
Get a list of all items to trade. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
java.util.Iterator<TradeItem> |
iterator()
Get an iterator for all the TradeItems. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
remove(int index)
Remove from the DiplomaticTrade. |
void |
remove(TradeItem newItem)
Remove a from the DiplomaticTrade. |
void |
removeType(TradeItem someItem)
Removes all trade items of the same class as the given argument. |
void |
setRecipient(Player newRecipient)
Set the recieving player. |
void |
setSender(Player newSender)
Set the sending player. |
void |
setStatus(DiplomaticTrade.TradeStatus status)
Set the trade status. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
protected void |
writeChildren(javax.xml.stream.XMLStreamWriter out)
Write the children of this object to a stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.List<TradeItem> items
private final Game game
private Player sender
private Player recipient
private DiplomaticTrade.TradeStatus status
| Constructor Detail |
|---|
public DiplomaticTrade(Game game,
Player sender,
Player recipient)
DiplomaticTrade instance.
game - a Game valuesender - a Player valuerecipient - a Player value
public DiplomaticTrade(Game game,
Player sender,
Player recipient,
java.util.List<TradeItem> items)
DiplomaticTrade instance.
game - The Game containing the trade.sender - The sending Player.recipient - The recipient Player.items - A list of items to trade.
public DiplomaticTrade(Game game,
org.w3c.dom.Element element)
DiplomaticTrade instance.
game - The Game containing the trade.element - an Element value| Method Detail |
|---|
public DiplomaticTrade.TradeStatus getStatus()
public void setStatus(DiplomaticTrade.TradeStatus status)
status - The new TradeStatus for this agreement.public final Player getSender()
Player.public final void setSender(Player newSender)
newSender - The new sending Player.public final Player getRecipient()
Player.public final void setRecipient(Player newRecipient)
newRecipient - The new recipient Player.public void add(TradeItem newItem)
newItem - The TradeItem to add.public void remove(TradeItem newItem)
newItem - The TradeItem to remove.public void remove(int index)
index - The index of the TradeItem to removepublic void removeType(TradeItem someItem)
someItem - a TradeItem valuepublic java.util.List<TradeItem> getTradeItems()
public java.util.Iterator<TradeItem> iterator()
public Player.Stance getStance()
Stance offered in this trade, or null if none.public java.util.List<Goods> getGoodsGivenBy(Player player)
Goods offered in this trade.public java.util.List<Colony> getColoniesGivenBy(Player player)
Colonys offered in this trade.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeChildren in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||