jfreerails.controller
Class RandomPathFinder
java.lang.Object
jfreerails.controller.RandomPathFinder
- All Implemented Interfaces:
- java.io.Serializable, FreerailsMutableSerializable, FreerailsPathIterator
public class RandomPathFinder
- extends java.lang.Object
- implements FreerailsPathIterator
Returns a random path along the track.
- Author:
- Luke Lindsay 13-Oct-2002
- See Also:
- Serialized Form
Method Summary |
boolean |
hasNext()
Tests whether the path has another segment. |
void |
nextSegment(IntLine line)
Gets the next segment of the path and places its coordinates in the
specified IntLine; then moves the iterator forwards by one path segment. |
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
trackExplorer
private final FlatTrackExplorer trackExplorer
p1
private final PositionOnTrack p1
p2
private final PositionOnTrack p2
tileSize
private static final int tileSize
- See Also:
- Constant Field Values
RandomPathFinder
public RandomPathFinder(FlatTrackExplorer tx)
hasNext
public boolean hasNext()
- Description copied from interface:
FreerailsPathIterator
- Tests whether the path has another segment.
- Specified by:
hasNext
in interface FreerailsPathIterator
nextSegment
public void nextSegment(IntLine line)
- Description copied from interface:
FreerailsPathIterator
- Gets the next segment of the path and places its coordinates in the
specified IntLine; then moves the iterator forwards by one path segment.
(The coordinates are placed the passed-in IntLine rather than a new
object to avoid the cost of object creation.)
- Specified by:
nextSegment
in interface FreerailsPathIterator