|
||||||||||
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.server.ai.AIObject
net.sf.freecol.server.ai.mission.Mission
net.sf.freecol.server.ai.mission.TransportMission
public class TransportMission
Mission for transporting units and goods on a carrier.
Unit
Field Summary |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
TransportMission(AIMain aiMain,
AIUnit aiUnit)
Creates a mission for the given AIUnit . |
|
TransportMission(AIMain aiMain,
org.w3c.dom.Element element)
Loads a TransportMission from the given element. |
|
TransportMission(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
Creates a new TransportMission and reads the given
element. |
Method Summary | |
---|---|
void |
addToTransportList(Transportable newTransportable)
Adds the given Transportable to the transport list. |
AIGoods |
buyGoodsInEurope(Connection connection,
GoodsType type,
int amount,
Location destination)
Buys the given cargo. |
void |
dispose()
Disposes this Mission . |
void |
doMission(Connection connection)
Performs the mission. |
int |
getAvailableSpace()
Returns the available space for any type of unit going to any type of location. |
int |
getAvailableSpace(Transportable t)
Returns the available space for the given Transportable . |
int |
getAvailableSpace(UnitType unitType,
Location source,
Location destination)
Returns the available space for the given type of Unit at
the given Location . |
java.lang.String |
getDebuggingInfo()
Gets debugging information about this mission. |
PathNode |
getPath(Transportable transportable)
Returns the path the carrier should use to get/drop the given Transportable . |
static int |
getPlayerNavalTransportMissionCount(AIPlayer aiPlayer,
Unit unitExcluded)
Gives the number of naval units assigned with a Transport Mission |
Tile |
getTransportDestination()
Returns the destination of a required transport. |
int |
getTransportPriority()
Returns the priority of getting the unit to the transport destination. |
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
boolean |
isOnTransportList(Transportable newTransportable)
Checks if the given Transportable is on the transport
list. |
boolean |
isValid()
Checks if this mission is still valid to perform. |
static boolean |
isValid(AIUnit aiUnit)
Checks if this mission is valid for the given unit. |
void |
removeFromTransportList(Transportable transportable)
Removes the given Transportable from the transport list. |
java.lang.String |
toString()
Creates a String representation of this mission to be used
for debugging purposes. |
Methods inherited from class net.sf.freecol.server.ai.mission.Mission |
---|
attack, buyGoods, findNearestColony, getAIUnit, getUnit |
Methods inherited from class net.sf.freecol.server.ai.AIObject |
---|
getAIMain, getGame, isUninitialized, readFromXML |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TransportMission(AIMain aiMain, AIUnit aiUnit)
AIUnit
.
aiMain
- The main AI-object.aiUnit
- The AIUnit
this mission is created for.public TransportMission(AIMain aiMain, org.w3c.dom.Element element)
TransportMission
from the given element.
aiMain
- The main AI-object.element
- An Element
containing an XML-representation
of this object.public TransportMission(AIMain aiMain, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
TransportMission
and reads the given
element.
aiMain
- The main AI-object.in
- The input stream containing the XML.
javax.xml.stream.XMLStreamException
- if a problem was encountered during parsing.AIObject.readFromXML(javax.xml.stream.XMLStreamReader)
Method Detail |
---|
public void dispose()
Mission
.
dispose
in class Mission
public boolean isOnTransportList(Transportable newTransportable)
Transportable
is on the transport
list.
newTransportable
- The Transportable
to be checked
true
if the given Transportable
was
on the transport list, and false
otherwise.public void removeFromTransportList(Transportable transportable)
Transportable
from the transport list.
This method calls Transportable.setTransport(AIUnit)
.
transportable
- The Transportable
.public void addToTransportList(Transportable newTransportable)
Transportable
to the transport list. The
method returns immediately if the Transportable
has already be
added.
Location
for the
Transportable
is entered into the transport list if the
Transportable
is not already loaded onto the transport. If
the Transportable
is onboard the transport, then only the
destination is put on the transport list.
newTransportable
- The Transportable
.public void doMission(Connection connection)
doMission
in class Mission
connection
- The Connection
to the server.public AIGoods buyGoodsInEurope(Connection connection, GoodsType type, int amount, Location destination)
Europe
.
connection
- The Connection
to use when communicating
with the server.type
- The type of goods to buy.amount
- The amount of goods to buy.destination
- The Location
to which the goods should
be transported.
public PathNode getPath(Transportable transportable)
Transportable
.
transportable
- The Transportable
.
public int getAvailableSpace(Transportable t)
Transportable
.
t
- The Transportable
Transportable
s with the
same source and
destination
.public int getAvailableSpace(UnitType unitType, Location source, Location destination)
Unit
at
the given Location
.
unitType
- The type of Unit
or null
for
Goods
source
- The source for the unit. This is where the unit is
presently located.destination
- The destination for the unit.
public int getAvailableSpace()
public static boolean isValid(AIUnit aiUnit)
aiUnit
- The unit.
true
if this mission is valid to perform and
false
otherwise.public boolean isValid()
isValid
in class Mission
true
public Tile getTransportDestination()
getTransportDestination
in class Mission
null
public int getTransportPriority()
getTransportPriority
in class Mission
public static int getPlayerNavalTransportMissionCount(AIPlayer aiPlayer, Unit unitExcluded)
public static java.lang.String getXMLElementTagName()
String
"transportMission".public java.lang.String getDebuggingInfo()
getDebuggingInfo
in class Mission
String
: "(x, y) z" or "(x, y) z!" where
x
and y
is the coordinates of the
target tile for this mission, and z
is the value
of building the colony. The exclamation mark is added if the unit
should continue searching for a colony site if the targeted site
is lost.public java.lang.String toString()
String
representation of this mission to be used
for debugging purposes.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |