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


public interface CostDecider

Determines the cost of a single move. Used by findPath and search.


Field Summary
static int ILLEGAL_MOVE
           
 
Method Summary
 int getCost(Unit unit, Tile oldTile, Tile newTile, int movesLeftBefore, int turns)
          Determines the cost of a single move.
 int getMovesLeft()
          Gets the number of moves left.
 boolean isNewTurn()
          Checks if a new turn is needed in order to make the move.
 

Field Detail

ILLEGAL_MOVE

static final int ILLEGAL_MOVE
See Also:
Constant Field Values
Method Detail

getCost

int getCost(Unit unit,
            Tile oldTile,
            Tile newTile,
            int movesLeftBefore,
            int turns)
Determines the cost of a single move.

Parameters:
unit - The Unit that will be used when determining the cost. This should be the same type of unit as the one following the path.
oldTile - The Tile we are moving from.
newTile - The Tile we are moving to.
movesLeftBefore - The remaining moves left. The CostDecider can use this information if needed.
turns - The number of turns spent so far.
Returns:
The cost of moving the given unit from the oldTile to the newTile.

getMovesLeft

int getMovesLeft()
Gets the number of moves left. This method should be called after invoking getCost(net.sf.freecol.common.model.Unit, net.sf.freecol.common.model.Tile, net.sf.freecol.common.model.Tile, int, int).

Returns:
The number of moves left.

isNewTurn

boolean isNewTurn()
Checks if a new turn is needed in order to make the move. This method should be called after invoking getCost(net.sf.freecol.common.model.Unit, net.sf.freecol.common.model.Tile, net.sf.freecol.common.model.Tile, int, int).

Returns:
true if the move requires a new turn and false otherwise.