jfreerails.world.train
Class TrainPathIterator

java.lang.Object
  extended by jfreerails.world.train.TrainPathIterator
All Implemented Interfaces:
java.io.Serializable, FreerailsMutableSerializable, FreerailsPathIterator

public class TrainPathIterator
extends java.lang.Object
implements FreerailsPathIterator

Exposes the path of a train. TODO needs better comment

Author:
Luke Lindsay
See Also:
Serialized Form

Field Summary
private  FreerailsIntIterator intIterator
           
private  PositionOnTrack p1
           
private  PositionOnTrack p2
           
private static long serialVersionUID
           
private static int tileSize
           
 
Constructor Summary
TrainPathIterator(FreerailsIntIterator i)
           
 
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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

intIterator

private final FreerailsIntIterator intIterator

p1

private final PositionOnTrack p1

p2

private final PositionOnTrack p2

tileSize

private static final int tileSize
See Also:
Constant Field Values
Constructor Detail

TrainPathIterator

public TrainPathIterator(FreerailsIntIterator i)
Method Detail

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