gramschmidt
Class GSStateModel

java.lang.Object
  extended by gramschmidt.GSStateModel

public class GSStateModel
extends java.lang.Object

State of the application (determines what is drawn). Note that this class is not implemented as a state-machine since the states are simply sequential.


Field Summary
static int STATE_EMPTY
           
static int STATE_INITIALIZED
           
static int STATE_NORMALIZED
           
static int STATE_ORTHOGONAL_1
           
static int STATE_ORTHOGONAL_2
           
static int STATE_ORTHOGONAL_3
           
static int STATE_PROJECTION_1
           
static int STATE_PROJECTION_2
           
static int STATE_SUBTRACTION_1
           
static int STATE_SUBTRACTION_2
           
 
Constructor Summary
GSStateModel()
          Create a new state model.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Add a ChangeListener.
 void fireStateChanged(javax.swing.event.ChangeEvent e)
          Notify all ChangeListeners.
 int getState()
           
 void nextState()
          Move to the next state.
 void previousState()
          Move to the previous state.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Remove a ChangeListener.
 void setState(int state)
          Set the current state.
 int statesDone()
           
 int statesRemaining()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_EMPTY

public static final int STATE_EMPTY
See Also:
Constant Field Values

STATE_INITIALIZED

public static final int STATE_INITIALIZED
See Also:
Constant Field Values

STATE_ORTHOGONAL_1

public static final int STATE_ORTHOGONAL_1
See Also:
Constant Field Values

STATE_PROJECTION_1

public static final int STATE_PROJECTION_1
See Also:
Constant Field Values

STATE_SUBTRACTION_1

public static final int STATE_SUBTRACTION_1
See Also:
Constant Field Values

STATE_ORTHOGONAL_2

public static final int STATE_ORTHOGONAL_2
See Also:
Constant Field Values

STATE_PROJECTION_2

public static final int STATE_PROJECTION_2
See Also:
Constant Field Values

STATE_SUBTRACTION_2

public static final int STATE_SUBTRACTION_2
See Also:
Constant Field Values

STATE_ORTHOGONAL_3

public static final int STATE_ORTHOGONAL_3
See Also:
Constant Field Values

STATE_NORMALIZED

public static final int STATE_NORMALIZED
See Also:
Constant Field Values
Constructor Detail

GSStateModel

public GSStateModel()
Create a new state model. This model will start at state STATE_EMPTY.

Method Detail

getState

public int getState()
Returns:
the current state.

setState

public void setState(int state)
Set the current state. Use one of the constants in GSStateModel as an argument.


statesRemaining

public int statesRemaining()
Returns:
the number of states that remain. This is the difference between the final state and the current state.

statesDone

public int statesDone()
Returns:
the number of states that are done. This is the difference between the current state and the initial state (not the empty state).

nextState

public void nextState()
Move to the next state. This method does nothing if the final state has been reached.


previousState

public void previousState()
Move to the previous state. This method does nothing if the initial state has been reached.


addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Add a ChangeListener.


removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Remove a ChangeListener.


fireStateChanged

public void fireStateChanged(javax.swing.event.ChangeEvent e)
Notify all ChangeListeners.