net.sf.freecol.common.model.pathfinding
Interface GoalDecider


public interface GoalDecider

Used by search in order to determine a goal.

The method check(Unit, PathNode) will be called by search until:

  1. The method returns true and there is no sub goals.
  2. The maximum distance of the search has been reached.
The method getGoal() will get called after this.


Method Summary
 boolean check(Unit u, PathNode pathNode)
          Checks wether the given PathNode is a goal/sub-goal.
 PathNode getGoal()
          Gets the PathNode containing the goal.
 boolean hasSubGoals()
          Determines wether this GoalDecider has any sub goals.
 

Method Detail

getGoal

PathNode getGoal()
Gets the PathNode containing the goal.

Returns:
The PathNode where the Tile returned by pathNode.getTile() is the goal.

hasSubGoals

boolean hasSubGoals()
Determines wether this GoalDecider has any sub goals.

Returns:
true if there are any sub goals and false otherwise.

check

boolean check(Unit u,
              PathNode pathNode)
Checks wether the given PathNode is a goal/sub-goal.

Parameters:
u - The Unit which we are trying to find a path for.
pathNode - The PathNode where the Tile returned by pathNode.getTile() is the tile to be checked.
Returns:
true if the PathNode was either a goal or a sub goal and false otherwise. The goal should be returned by getGoal() right after a call to this method, if this method returns true and hasSubGoals() returns false.