jfreerails.server
Class TrainPathFinder
java.lang.Object
jfreerails.server.TrainPathFinder
- All Implemented Interfaces:
- java.io.Serializable, ServerAutomaton, FreerailsIntIterator
public class TrainPathFinder
- extends java.lang.Object
- implements FreerailsIntIterator, ServerAutomaton
This class provides methods that generate a path to a target as a series of
PositionOnTrack objects encoded as ints, it also deals with stops at
stations.
- Author:
- Luke Lindsay 28-Nov-2002
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
pathFinder
private final SimpleAStarPathFinder pathFinder
principal
private final FreerailsPrincipal principal
stopsHandler
private final TrainStopsHandler stopsHandler
trackExplorer
private final FlatTrackExplorer trackExplorer
trainId
private final int trainId
mr
private transient MoveReceiver mr
w
ReadOnlyWorld w
TrainPathFinder
public TrainPathFinder(FlatTrackExplorer tx,
ReadOnlyWorld w,
int trainNumber,
MoveReceiver newMr,
FreerailsPrincipal p)
hasNextInt
public boolean hasNextInt()
- Specified by:
hasNextInt
in interface FreerailsIntIterator
initAutomaton
public void initAutomaton(MoveReceiver newMr)
- Description copied from interface:
ServerAutomaton
- Initializes the automaton with a connection to the MoveExecuter.
- Specified by:
initAutomaton
in interface ServerAutomaton
isTrainMoving
boolean isTrainMoving()
nextInt
public int nextInt()
- Specified by:
nextInt
in interface FreerailsIntIterator
- Returns:
- a PositionOnTrack packed into an int