|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.kzoo.grid.gui.GridAppController | +--edu.kzoo.grid.gui.ActiveGridAppController | +--IterationController
Grid Iterator Lab:
The IterationController
class provides the methods
for stepping through a grid using one of a number of
iterators (which must be registered using the register
method). It places colored blocks in the cells of the grid
as it goes to illustrate the traversal.
Constructor Summary | |
IterationController()
|
Method Summary | |
void |
empty(edu.kzoo.grid.BoundedGrid grid)
Empties the grid. |
static java.util.List |
getAlgNames()
Gets the list of registered algorithm names. |
static GridIterator |
getIterator(java.lang.String name,
edu.kzoo.grid.BoundedGrid grid)
Constructs the iterator with the specified name. |
boolean |
hasReachedStoppingState()
Determines whether the iteration has reached a desired stopping state. |
static void |
register(java.lang.String name,
java.lang.Class iteratorClass)
Registers the specified class with a name. |
void |
startIteration(java.lang.String name,
edu.kzoo.grid.BoundedGrid grid,
java.awt.Color color)
Starts the iteration with the given name through the specified grid. |
void |
step()
|
Methods inherited from class edu.kzoo.grid.gui.GridAppController |
getGrid, restart, setGrid |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IterationController()
Method Detail |
public static void register(java.lang.String name, java.lang.Class iteratorClass)
name
- name (button label) of traversal or drawing algorithmiteratorClass
- class that implements the associated iteratorpublic static java.util.List getAlgNames()
public static GridIterator getIterator(java.lang.String name, edu.kzoo.grid.BoundedGrid grid)
name
- name of traversal or drawing algorithm
public void startIteration(java.lang.String name, edu.kzoo.grid.BoundedGrid grid, java.awt.Color color)
name
- name of the iteration technique to usegrid
- grid through which to iteratecolor
- color to use to mark the traversalpublic void step()
step
in class edu.kzoo.grid.gui.ActiveGridAppController
public boolean hasReachedStoppingState()
true
if
the traversal has finished or if it appears to be in an
unproductive loop (it has visited more locations than exist
in the grid).
hasReachedStoppingState
in class edu.kzoo.grid.gui.GridAppController
true
if the application should stoppublic void empty(edu.kzoo.grid.BoundedGrid grid)
grid
- grid to empty
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |