|
|||||||||
| 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.goal.Goal
net.sf.freecol.server.ai.goal.ManageMissionariesGoal
public class ManageMissionariesGoal
This Goal deals with all missionaries of one AIPlayer.
For each missionary unit that is being added, this goal will try to find
an IndianSettlement needing a visit.
Distance and reachability from the current position of the unit are taken into
account, with the implicit assumption that the current location of the unit
is sensible in that a nearby settlement is even worth visiting.
Since missionary units are either created in a player-owned colony,
or brought there from Europe, this assumption will most often be valid.
If a settlement has been found, a CreateMissionAtSettlementGoal
will be created, and the unit be moved there.
| Field Summary | |
|---|---|
private static java.util.logging.Logger |
logger
|
private java.util.List<Goal> |
subGoalList
|
| Fields inherited from class net.sf.freecol.server.ai.goal.Goal |
|---|
availableUnitsList, isFinished, needsPlanning, player |
| 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, PARTIAL_ATTRIBUTE |
| Fields inherited from interface net.sf.freecol.server.ai.goal.GoalConstants |
|---|
MAX_SEARCH_RADIUS |
| Constructor Summary | |
|---|---|
ManageMissionariesGoal(AIPlayer p,
Goal g,
float w)
|
|
| Method Summary | |
|---|---|
private IndianSettlement |
findSettlement(Tile t)
|
java.lang.String |
getGoalDescription()
Returns a string describing just this goal. |
protected java.util.Iterator<AIUnit> |
getOwnedAIUnitsIterator()
Since internal implementation details may vary, each Goal will define an iterator over all of its units. |
protected java.util.Iterator<Goal> |
getSubGoalIterator()
Since internal implementation details may vary, each Goal will define an iterator over all of its subgoals. |
protected void |
plan()
Plans this goal. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Reads information for this object from an XML stream. |
protected void |
removeUnit(AIUnit u)
Ensures that a unit moved to another Goal is properly removed from this. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Writes this object to an XML stream. |
| Methods inherited from class net.sf.freecol.server.ai.goal.Goal |
|---|
addUnit, addUnitToParent, cancelGoal, canYieldUnit, doPlanning, getAbsoluteWeight, getDebugDescription, getParentWeight, getWeight, getXMLElementTagName, getYieldedUnitWeight, isFinished, needsPlanning, normalizeSubGoalWeights, requestWorker, setNeedsPlanningRecursive, setWeight, validateOwnedUnits, yieldUnit |
| Methods inherited from class net.sf.freecol.server.ai.AIObject |
|---|
dispose, getAIMain, getAIRandom, getGame, 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 java.util.List<Goal> subGoalList
| Constructor Detail |
|---|
public ManageMissionariesGoal(AIPlayer p,
Goal g,
float w)
| Method Detail |
|---|
protected java.util.Iterator<AIUnit> getOwnedAIUnitsIterator()
Goal
getOwnedAIUnitsIterator in class GoalAIUnit currently managed by this goal.protected java.util.Iterator<Goal> getSubGoalIterator()
Goal
getSubGoalIterator in class Goalprotected void removeUnit(AIUnit u)
GoalGoal.yieldUnit(UnitType,AIObject),
or if the Unit contained in the AIUnit no longer is valid,
this method is called to clean up any remaining references to the unit.
Any implementation of this will need to iterate over all AIUnit object references used by this goal, and remove those that equal the given parameter.
removeUnit in class Goalu - The AIUnit supposed to be removed from this goal.protected void plan()
plan in class Goalpublic java.lang.String getGoalDescription()
GoalgetDebugDescription.
getGoalDescription in class Goal
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
Goal
toXMLImpl in class Goalout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
Goal
readFromXMLImpl in class Goalin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if there are any problems reading from the
stream.private IndianSettlement findSettlement(Tile t)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||