net.sf.freecol.common.model
Interface CostDecider

All Known Implementing Classes:
DefaultCostDecider

public interface CostDecider

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


Field Summary
static java.lang.String COPYRIGHT
           
static int ILLEGAL_MOVE
           
static java.lang.String LICENSE
           
static java.lang.String REVISION
           
 
Method Summary
 int getCost(Unit unit, Tile oldTile, Tile newTile, int movesLeft, 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

COPYRIGHT

static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

LICENSE

static final java.lang.String LICENSE
See Also:
Constant Field Values

REVISION

static final java.lang.String REVISION
See Also:
Constant Field Values

ILLEGAL_MOVE

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

getCost

int getCost(Unit unit,
            Tile oldTile,
            Tile newTile,
            int movesLeft,
            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.
movesLeft - 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 og 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.