|
||||||||||
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.FreeColGameObject
net.sf.freecol.common.model.TradeRoute
public class TradeRoute
A TradeRoute holds all information for a unit to follow along a trade route.
Nested Class Summary | |
---|---|
class |
TradeRoute.Stop
|
Field Summary | |
---|---|
static TradeRoute |
NO_TRADE_ROUTE
|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
TradeRoute(Game game,
org.w3c.dom.Element e)
Creates a new TradeRoute instance. |
|
TradeRoute(Game game,
java.lang.String name,
Player player)
Creates a new TradeRoute instance. |
|
TradeRoute(Game game,
javax.xml.stream.XMLStreamReader in)
Creates a new TradeRoute instance. |
Method Summary | |
---|---|
void |
addStop(TradeRoute.Stop stop)
Add a new Stop to this trade route. |
TradeRoute |
clone()
Clone the trade route and return a deep copy. |
java.util.List<Unit> |
getAssignedUnits()
|
int |
getCount()
Get the Count value. |
java.lang.String |
getName()
Get the Name value. |
Player |
getOwner()
Get the Owner value. |
java.util.ArrayList<TradeRoute.Stop> |
getStops()
Get the Stops value. |
static java.lang.String |
getStopXMLElementTagName()
Returns the tag name of the root element representing this object. |
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
boolean |
isModified()
Get the Modified value. |
static boolean |
isStopValid(Player player,
TradeRoute.Stop stop)
|
static boolean |
isStopValid(Unit unit,
TradeRoute.Stop stop)
|
void |
newTurn()
A traderoute does not do anything on a new turn. |
void |
setCount(int newCount)
Set the Count value. |
void |
setModified(boolean newModified)
Set the Modified value. |
void |
setName(java.lang.String newName)
Set the Name value. |
void |
setOwner(Player newOwner)
Set the Owner value. |
void |
setStops(java.util.ArrayList<TradeRoute.Stop> newStops)
Set the Stops value. |
java.lang.String |
toString()
Returns a string representation of the object. |
void |
updateFrom(TradeRoute other)
Copy all fields from another trade route to this one. |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toXML, updateFreeColGameObject, updateID |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final TradeRoute NO_TRADE_ROUTE
Constructor Detail |
---|
public TradeRoute(Game game, java.lang.String name, Player player)
TradeRoute
instance.
game
- a Game
valuename
- a String
valueplayer
- a Player
valuepublic TradeRoute(Game game, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
TradeRoute
instance.
game
- a Game
valuein
- a XMLStreamReader
value
javax.xml.stream.XMLStreamException
- if an error occurspublic TradeRoute(Game game, org.w3c.dom.Element e)
TradeRoute
instance.
game
- a Game
valuee
- an Element
valueMethod Detail |
---|
public void updateFrom(TradeRoute other)
other
- The route to copy from.public final boolean isModified()
Modified
value.
boolean
valuepublic final void setModified(boolean newModified)
Modified
value.
newModified
- The new Modified value.public final java.lang.String getName()
Name
value.
String
valuepublic final void setName(java.lang.String newName)
Name
value.
newName
- The new Name value.public int getCount()
Count
value.
public void setCount(int newCount)
Count
value.
newCount
- The new Count value.public void addStop(TradeRoute.Stop stop)
Stop
to this trade route.
stop
- The Stop
to add.public final Player getOwner()
Owner
value.
getOwner
in interface Ownable
Player
valuepublic final void setOwner(Player newOwner)
Owner
value.
setOwner
in interface Ownable
newOwner
- The new Owner value.public java.lang.String toString()
FreeColGameObject
toString
in class FreeColGameObject
String
public java.util.List<Unit> getAssignedUnits()
public final java.util.ArrayList<TradeRoute.Stop> getStops()
Stops
value.
ArrayList
valuepublic final void setStops(java.util.ArrayList<TradeRoute.Stop> newStops)
Stops
value.
newStops
- The new Stops value.public void newTurn()
public TradeRoute clone()
The copied trade route has no reference back to the original and can safely be used as a temporary copy. It is NOT registered with the game, but will have the same unique id as the original.
clone
in class java.lang.Object
public static boolean isStopValid(Unit unit, TradeRoute.Stop stop)
public static boolean isStopValid(Player player, TradeRoute.Stop stop)
public static java.lang.String getXMLElementTagName()
public static java.lang.String getStopXMLElementTagName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |