net.sf.freecol.server.ai.goal
Class GotoAdjacentGoal

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.server.ai.AIObject
          extended by net.sf.freecol.server.ai.goal.Goal
              extended by net.sf.freecol.server.ai.goal.GotoAdjacentGoal
All Implemented Interfaces:
GoalConstants

public class GotoAdjacentGoal
extends Goal


Field Summary
private static java.util.logging.Logger logger
           
private  Tile target
           
 
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
GotoAdjacentGoal(AIPlayer p, Goal g, float w, AIUnit u, Tile t)
           
 
Method Summary
 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()
          This is the method that actually does the planning for 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 net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, setId, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

target

private Tile target
Constructor Detail

GotoAdjacentGoal

public GotoAdjacentGoal(AIPlayer p,
                        Goal g,
                        float w,
                        AIUnit u,
                        Tile t)
Method Detail

getOwnedAIUnitsIterator

protected java.util.Iterator<AIUnit> getOwnedAIUnitsIterator()
Description copied from class: Goal
Since internal implementation details may vary, each Goal will define an iterator over all of its units.

Specified by:
getOwnedAIUnitsIterator in class Goal
Returns:
An Iterator over all AIUnit currently managed by this goal.

getSubGoalIterator

protected java.util.Iterator<Goal> getSubGoalIterator()
Description copied from class: Goal
Since internal implementation details may vary, each Goal will define an iterator over all of its subgoals.

Specified by:
getSubGoalIterator in class Goal
Returns:
An Iterator over all currently existing subgoals.

removeUnit

protected void removeUnit(AIUnit u)
Description copied from class: Goal
Ensures that a unit moved to another Goal is properly removed from this. If a unit is removed from this goal via Goal.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.

Specified by:
removeUnit in class Goal
Parameters:
u - The AIUnit supposed to be removed from this goal.

plan

protected void plan()
Description copied from class: Goal
This is the method that actually does the planning for this goal. It should contain:

Specified by:
plan in class Goal

getGoalDescription

public java.lang.String getGoalDescription()
Description copied from class: Goal
Returns a string describing just this goal. An implementing class may override this method to add specialized information. Used by getDebugDescription.

Overrides:
getGoalDescription in class Goal
Returns:
a string describing this goal

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
Description copied from class: Goal
Writes this object to an XML stream.

Specified by:
toXMLImpl in class Goal
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Description copied from class: Goal
Reads information for this object from an XML stream.

Specified by:
readFromXMLImpl in class Goal
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems reading from the stream.