Class EnvIterator

java.lang.Object
  |
  +--EnvIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
ColMajorEnvIterator, RowMajorEnvIterator

public abstract class EnvIterator
extends java.lang.Object
implements java.util.Iterator

Environment-Based Applications:
An EnvIterator object provides an iterator that that steps through the locations of a BoundedEnv object in a particular order.

EnvIterator implementations need not support the remove method, as it does not make sense to remove locations from a bounded environment.

See Also:
BoundedEnv, Location, EnvDisplay

Constructor Summary
EnvIterator(BoundedEnv environment)
          Constructs an iterator object that steps through an environment starting at location (0, 0).
EnvIterator(BoundedEnv environment, Location startingLoc)
          Constructs an iterator object that steps through an environment, starting at a given location.
 
Method Summary
 BoundedEnv environment()
          Returns environment through which this iterator iterates.
protected abstract  Location findNextLocation()
          Helper Method: Finds next location for iterator.
 boolean hasNext()
          Returns true if the environment has more locations.
 java.lang.Object next()
          Returns the next location in the environment.
protected  Location nextLocation()
          Returns next location (pure accessor -- does not advance iterator).
 void remove()
          Removes from the underlying collection the last element returned by the iterator (not supported).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvIterator

public EnvIterator(BoundedEnv environment)
Constructs an iterator object that steps through an environment starting at location (0, 0).
Parameters:
environment - environment to iterate through

EnvIterator

public EnvIterator(BoundedEnv environment,
                   Location startingLoc)
Constructs an iterator object that steps through an environment, starting at a given location.
Parameters:
environment - environment to iterate through
startingLoc - where to start the iteration
Method Detail

environment

public BoundedEnv environment()
Returns environment through which this iterator iterates.

hasNext

public boolean hasNext()
Returns true if the environment has more locations.
Specified by:
hasNext in interface java.util.Iterator

nextLocation

protected Location nextLocation()
Returns next location (pure accessor -- does not advance iterator).

next

public java.lang.Object next()
Returns the next location in the environment.
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (not supported).
Specified by:
remove in interface java.util.Iterator

findNextLocation

protected abstract Location findNextLocation()
Helper Method: Finds next location for iterator.