edu.kzoo.grid.gui
Class SteppedGridAppController

java.lang.Object
  |
  +--edu.kzoo.grid.gui.SteppedGridAppController
Direct Known Subclasses:
ActiveGridAppController

public abstract class SteppedGridAppController
extends java.lang.Object

Grid GUI Support Package:
A SteppedGridAppController controls the running of a stepped grid application.

Version:
29 February 2004
Author:
Alyce Brady

Constructor Summary
SteppedGridAppController()
           
 
Method Summary
 Grid getGrid()
          Gets the application's grid.
 boolean hasReachedStoppingState()
          Determines whether a running application has reached a desired stopping state.
 void init()
          Initializes or re-initializes the state of the grid application.
 void setGrid(Grid grid)
          Sets the application's grid.
abstract  void step()
          Advances the application one step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SteppedGridAppController

public SteppedGridAppController()
Method Detail

getGrid

public Grid getGrid()
Gets the application's grid.

Returns:
the grid being controlled

setGrid

public void setGrid(Grid grid)
Sets the application's grid. (Precondition: grid is not null.)

Parameters:
grid - the Grid to act on

init

public void init()
Initializes or re-initializes the state of the grid application.


step

public abstract void step()
Advances the application one step. (Note: there is no precondition on this method that getGrid() must return a non-null grid, so subclass implementations should handle the possibility of a null grid gracefully.)


hasReachedStoppingState

public boolean hasReachedStoppingState()
Determines whether a running application has reached a desired stopping state. Examples include whether the mouse in a maze has found the cheese, whether the first (or last) competitor in a race has finished, or whether a chemical reaction has reached equilibrium.

Returns:
true if the application should stop