|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EnvIterator
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.
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 |
public EnvIterator(BoundedEnv environment)
environment
- environment to iterate throughpublic EnvIterator(BoundedEnv environment, Location startingLoc)
environment
- environment to iterate throughstartingLoc
- where to start the iterationMethod Detail |
public BoundedEnv environment()
public boolean hasNext()
hasNext
in interface java.util.Iterator
protected Location nextLocation()
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
protected abstract Location findNextLocation()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |