jfreerails.world.train
Class SimplePathIteratorImpl

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

public class SimplePathIteratorImpl
extends java.lang.Object
implements FreerailsPathIterator

Exposes a path stored as an array of x points and an array of y points.

Author:
Luke
See Also:
Serialized Form

Field Summary
private  int position
           
private static long serialVersionUID
           
private  ImInts x
           
private  ImInts y
           
 
Constructor Summary
SimplePathIteratorImpl(ImInts xpoints, ImInts ypoints)
           
SimplePathIteratorImpl(int[] xpoints, int[] ypoints)
           
 
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

x

private final ImInts x

y

private final ImInts y

position

private int position
Constructor Detail

SimplePathIteratorImpl

public SimplePathIteratorImpl(ImInts xpoints,
                              ImInts ypoints)

SimplePathIteratorImpl

public SimplePathIteratorImpl(int[] xpoints,
                              int[] ypoints)
Method Detail

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

hasNext

public boolean hasNext()
Description copied from interface: FreerailsPathIterator
Tests whether the path has another segment.

Specified by:
hasNext in interface FreerailsPathIterator