|
|||||||||
| 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.
| Field Summary | |
|---|---|
private boolean |
accept
Whether this is the accept instance. |
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. |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE |
| 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 a TradeItem to the DiplomaticTrade. |
java.util.List<Colony> |
getColoniesGivenBy(Player player)
Returns a list of colonies given by Player |
Game |
getGame()
Gets the game object this DiplomaticTrade belongs to. |
java.util.List<Goods> |
getGoodsGivenBy(Player player)
Returns a list of goods given by Player |
Player |
getRecipient()
Get the Recipient value. |
Player |
getSender()
Get the Sender value. |
Player.Stance |
getStance()
Returns the stance being offered, or null if none is being offered. |
java.util.List<TradeItem> |
getTradeItems()
Returns all TradeItems. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
isAccept()
Get the Accept value. |
java.util.Iterator<TradeItem> |
iterator()
Returns an iterator for all TradeItems. |
java.util.List<FreeColGameObject> |
makeTrade()
Calls the makeTrade method of all TradeItems. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
remove(int index)
Remove a TradeItem from the DiplomaticTrade. |
void |
remove(TradeItem newItem)
Remove a TradeItem from the DiplomaticTrade. |
void |
removeType(TradeItem someItem)
Removes all trade items of the same class as the given argument. |
void |
setAccept(boolean newAccept)
Set the Accept value. |
void |
setRecipient(Player newRecipient)
Set the Recipient value. |
void |
setSender(Player newSender)
Set the Sender 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 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 boolean accept
| 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 - a Game valuesender - a Player valuerecipient - a Player value
public DiplomaticTrade(Game game,
org.w3c.dom.Element element)
DiplomaticTrade instance.
game - a Game valueelement - an Element value| Method Detail |
|---|
public Game getGame()
DiplomaticTrade belongs to.
game.public final boolean isAccept()
Accept value.
boolean valuepublic final void setAccept(boolean newAccept)
Accept value.
newAccept - The new Accept value.public final Player getSender()
Sender value.
Player valuepublic final void setSender(Player newSender)
Sender value.
newSender - The new Sender value.public final Player getRecipient()
Recipient value.
Player valuepublic final void setRecipient(Player newRecipient)
Recipient value.
newRecipient - The new Recipient value.public void add(TradeItem newItem)
newItem - a TradeItem valuepublic void remove(TradeItem newItem)
newItem - a TradeItem valuepublic void remove(int index)
index - the index of the TradeItem to removepublic void removeType(TradeItem someItem)
someItem - a TradeItem valuepublic Player.Stance getStance()
int valuepublic java.util.List<Goods> getGoodsGivenBy(Player player)
Player
Goods offered by the player, empty if none givenpublic java.util.List<Colony> getColoniesGivenBy(Player player)
Player
Colony offered by the player, empty if none givenpublic java.util.List<FreeColGameObject> makeTrade()
makeTrade method of all TradeItems.
public java.util.List<TradeItem> getTradeItems()
public java.util.Iterator<TradeItem> iterator()
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 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.public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||