|
||||||||||
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 |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_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 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. |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiplomaticTrade(Game game, Player sender, Player recipient)
DiplomaticTrade
instance.
game
- a Game
valuesender
- a Player
valuerecipient
- a Player
valuepublic DiplomaticTrade(Game game, Player sender, Player recipient, java.util.List<TradeItem> items)
DiplomaticTrade
instance.
game
- a Game
valuesender
- a Player
valuerecipient
- a Player
valuepublic DiplomaticTrade(Game game, org.w3c.dom.Element element)
DiplomaticTrade
instance.
game
- a Game
valueelement
- an Element
valueMethod 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()
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
out
- 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 |