jfreerails.world.common
Class FreerailsPathIteratorImpl

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

public class FreerailsPathIteratorImpl
extends java.lang.Object
implements FreerailsPathIterator

Lets the caller access a series of Points as a series of IntLines.

Author:
Luke Lindsay
See Also:
Serialized Form

Field Summary
private  boolean forwards
           
private  java.util.List<java.awt.Point> points
           
private  int position
           
private static long serialVersionUID
           
 
Constructor Summary
FreerailsPathIteratorImpl(java.util.List<java.awt.Point> l, boolean f)
          Creates new FreerailsPathIteratorImpl
 
Method Summary
static FreerailsPathIterator backwardsIterator(java.util.List<java.awt.Point> l)
           
static FreerailsPathIterator forwardsIterator(java.util.List<java.awt.Point> l)
           
 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

forwards

private final boolean forwards

position

private int position

points

private final java.util.List<java.awt.Point> points
Constructor Detail

FreerailsPathIteratorImpl

public FreerailsPathIteratorImpl(java.util.List<java.awt.Point> l,
                                 boolean f)
Creates new FreerailsPathIteratorImpl

Method Detail

forwardsIterator

public static FreerailsPathIterator forwardsIterator(java.util.List<java.awt.Point> l)

backwardsIterator

public static FreerailsPathIterator backwardsIterator(java.util.List<java.awt.Point> l)

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