- public class DijkstraMoveCalculator
- extends MoveCalculator
Calculates a MovePath for a move of the given unit-group from its current position to Field .
Moves the unit with the given id to field .
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DijkstraMoveCalculator(Registry registry)
public boolean moveUnit(long id,
- Moves the unit with the given id to field . A field with Coordinate
must exist (no test on this is performed) and field must
especially be a neighborfield of the field the unit is currently located
on (a test on this is performed, see below).
A unit with id must exist.
Performes all necessary datastructure-updates.
Especially, this function takes into account the time the unit has left
this turn, its speed and its distance to field . If uncomplete
moves are allowed, the unit may have started a move to some
neighbor-field, this will be taken into account.
If time doesn't suffice, dependend on areIncompleteMovesAllowed (AIMA),
the following two cases exist:
AIMA = true: The timeAwayFromSourceField and incompleteMoveDestField-
attributes are set correctly
AIMA = false: If the unit hasn't moved up to now this turn, it can move
to nevertheless. Otherwise, it cannot move at all, so
all relevant datastructures remain unchanged.
NOTE: None of the cases described above is a reason for returning false
The function tests for being a neighbor-field (case EA),
existence of unit (case EB).
- Specified by:
moveUnit in class
id - unit-id as described
to - field to move to
- false, if one of the (error-) cases EA, EB happened,
public MovePath calculateOneMovePath(java.util.Collection unitCollection,
- Calculates a MovePath for a move of the given unit-group from its current position to Field .
- Specified by:
calculateOneMovePath in class
to - a Field
- a MovePath as described