org.xnap.util
Class FiniteStateMachine

java.lang.Object
  extended by org.xnap.util.AbstractStateMachine
      extended by org.xnap.util.FiniteStateMachine

public class FiniteStateMachine
extends AbstractStateMachine


Constructor Summary
FiniteStateMachine(State initialState)
           
FiniteStateMachine(State initialState, java.util.Hashtable successorsByState)
           
 
Method Summary
protected  void canChange(State oldState, State newState)
          Invoked when a state transition is attempted.
static java.util.Hashtable createStateTable(State[][] table)
           
 void putState(State state, java.util.HashSet successors)
           
protected  void stateChanged(State oldState, State newState)
          Does nothing.
protected  void stateChangedFailed(State oldState, State newState)
          Throws an IllegalOperationException.
 
Methods inherited from class org.xnap.util.AbstractStateMachine
getDescription, getState, setDescription, setState, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FiniteStateMachine

public FiniteStateMachine(State initialState,
                          java.util.Hashtable successorsByState)

FiniteStateMachine

public FiniteStateMachine(State initialState)
Method Detail

putState

public void putState(State state,
                     java.util.HashSet successors)

canChange

protected void canChange(State oldState,
                         State newState)
Description copied from class: AbstractStateMachine
Invoked when a state transition is attempted. Should throw an exception if transistion is invalid.

Specified by:
canChange in class AbstractStateMachine

stateChanged

protected void stateChanged(State oldState,
                            State newState)
Does nothing. Subclasses should overwrite this method.

Specified by:
stateChanged in class AbstractStateMachine

stateChangedFailed

protected void stateChangedFailed(State oldState,
                                  State newState)
Throws an IllegalOperationException. Subclasses can overwrite this method.

Throws:
IllegalOperationException - thrown if the state transition is not valid

createStateTable

public static java.util.Hashtable createStateTable(State[][] table)


Copyright © 2001-2005 XNap Team. All Rights Reserved.