|
|||||||||
| 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.PioneeringMission
public class PioneeringMission
Mission for controlling a pioneer.
Unit.Role.PIONEER| Field Summary | |
|---|---|
private Colony |
colonyWithTools
A colony to go to to equip if required. |
private static java.util.logging.Logger |
logger
|
private static int |
MAX_TURNS
Maximum number of turns to travel to make progress on pioneering. |
private TileImprovementPlan |
tileImprovementPlan
The improvement this pioneer is to work on. |
| Fields inherited from class net.sf.freecol.server.ai.mission.Mission |
|---|
MINIMUM_TRANSPORT_PRIORITY, NO_MORE_MOVES_LEFT, NO_PATH_TO_TARGET, NORMAL_TRANSPORT_PRIORITY |
| Fields inherited from class net.sf.freecol.server.ai.AIObject |
|---|
uninitialized |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
PioneeringMission(AIMain aiMain,
AIUnit aiUnit)
Creates a pioneering mission for the given AIUnit. |
|
PioneeringMission(AIMain aiMain,
org.w3c.dom.Element element)
Loads a mission from the given element. |
|
PioneeringMission(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
Creates a new PioneeringMission and reads the
given element. |
|
| Method Summary | |
|---|---|
private void |
abandonTileImprovementPlan()
Abandons the current plan if any. |
private static boolean |
checkColonyForTools(AIUnit aiUnit,
Colony colony)
Checks if a colony can provide the tools required for a pioneer. |
private boolean |
checkTileImprovementPlan(TileImprovementPlan tip)
Checks that a tile improvement plan is valid. |
void |
dispose()
Disposes of this pioneering mission. |
void |
doMission(Connection connection)
Performs this mission. |
static Colony |
findColonyWithTools(AIUnit aiUnit)
Finds the closest colony within MAX_TURNS that can equip the unit. |
static TileImprovementPlan |
findTileImprovementPlan(AIUnit aiUnit)
Finds the best tile improvement plan for a supplied AI unit. |
java.lang.String |
getDebuggingInfo()
Gets debugging information about this mission. |
TileImprovementPlan |
getTileImprovementPlan()
Gets the TileImprovementPlan for this mission. |
Location |
getTransportDestination()
Gets the transport destination for units with this mission. |
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
private boolean |
hasTools()
Does this pioneer have tools? |
private static boolean |
hasTools(AIUnit aiUnit)
Does a supplied unit have tools? |
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. |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
|
void |
setTileImprovementPlan(TileImprovementPlan tip)
Sets the TileImprovementPlan which should
be the next target. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Writes all of the AIObjects and other AI-related
information to an XML-stream. |
private static boolean |
validateTileImprovementPlan(TileImprovementPlan tip,
EuropeanAIPlayer aiPlayer)
Weeds out a broken or obsolete tile improvement plan. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
|
| Methods inherited from class net.sf.freecol.server.ai.mission.Mission |
|---|
findNearestOtherSettlement, findTarget, getAIRandom, getAIUnit, getEuropeanAIPlayer, getPathStartTile, getTransportPriority, getUnit, isOneTime, moveButDontAttack, moveRandomly, moveTowards, moveTowards, moveUnitToAmerica, moveUnitToEurope, sellCargoInEurope, setAIUnit, shouldTakeTransportToTile, travelToTarget, unitLeavesShip, unloadCargoInColony |
| Methods inherited from class net.sf.freecol.server.ai.AIObject |
|---|
getAIMain, getGame, getSpecification, isUninitialized, readFromXML |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private static final int MAX_TURNS
private TileImprovementPlan tileImprovementPlan
private Colony colonyWithTools
| Constructor Detail |
|---|
public PioneeringMission(AIMain aiMain,
AIUnit aiUnit)
AIUnit.
Note that PioneeringMission.isValid(aiUnit) should be called
before this, to guarantee that
findTileImprovementPlan/findColonyWithTools succeed.
aiMain - The main AI-object.aiUnit - The AIUnit this mission
is created for.
public PioneeringMission(AIMain aiMain,
org.w3c.dom.Element element)
aiMain - The main AI-object.element - An Element containing an
XML-representation of this object.
public PioneeringMission(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
PioneeringMission 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 TileImprovementPlan getTileImprovementPlan()
TileImprovementPlan for this mission.
TileImprovementPlan.public void setTileImprovementPlan(TileImprovementPlan tip)
TileImprovementPlan which should
be the next target.
tip - The TileImprovementPlan.private void abandonTileImprovementPlan()
public void dispose()
dispose in class Missionprivate static boolean hasTools(AIUnit aiUnit)
unit - The pioneer Unit to check.
private boolean hasTools()
private static boolean checkColonyForTools(AIUnit aiUnit,
Colony colony)
aiUnit - The AIUnit that needs tools.colony - The Colony to check.
public static Colony findColonyWithTools(AIUnit aiUnit)
aiUnit - The AIUnit to equip.
private static boolean validateTileImprovementPlan(TileImprovementPlan tip,
EuropeanAIPlayer aiPlayer)
tip - The TileImprovementPlan to test.aiPlayer - The AIPlayer that owns the plan.
private boolean checkTileImprovementPlan(TileImprovementPlan tip)
tip - The TileImprovementPlan to check.
public static TileImprovementPlan findTileImprovementPlan(AIUnit aiUnit)
aiUnit - The AIUnit to find a plan for.
public Location getTransportDestination()
getTransportDestination in class MissionTransportable.public boolean isValid()
isValid in class Missionpublic static boolean isValid(AIUnit aiUnit)
aiUnit - The AIUnit to check.
public void doMission(Connection connection)
doMission in class Missionconnection - The Connection to the server.public java.lang.String getDebuggingInfo()
getDebuggingInfo in class MissionString:
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
AIObjects and other AI-related
information to an XML-stream.
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 Missionout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class Missionin - The XML input stream.
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 | ||||||||