|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--GridIterator
Grid Iterator Lab:
A GridIterator object provides an iterator that that
steps through the locations of a BoundedGrid object
in a particular order.
GridIterator implementations need not support the remove method, as it does not make sense to remove locations from a bounded grid.
BoundedGrid
,
Location
Constructor Summary | |
GridIterator(edu.kzoo.grid.BoundedGrid grid)
Constructs an iterator object that steps through a grid starting at location (0, 0). |
|
GridIterator(edu.kzoo.grid.BoundedGrid grid,
edu.kzoo.grid.Location startingLoc)
Constructs an iterator object that steps through a grid, starting at a given location. |
Method Summary | |
edu.kzoo.grid.BoundedGrid |
grid()
Returns grid through which this iterator iterates. |
boolean |
hasNext()
Returns true if the grid has more locations. |
java.lang.Object |
next()
Returns the next location in the grid. |
void |
remove()
Removes from the underlying collection the last element returned by the iterator (not supported). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GridIterator(edu.kzoo.grid.BoundedGrid grid)
grid
- grid to iterate throughpublic GridIterator(edu.kzoo.grid.BoundedGrid grid, edu.kzoo.grid.Location startingLoc)
grid
- grid to iterate throughstartingLoc
- where to start the iterationMethod Detail |
public edu.kzoo.grid.BoundedGrid grid()
public boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |