org.xnap.util
Class AbstractStateMachine
java.lang.Object
org.xnap.util.AbstractStateMachine
- Direct Known Subclasses:
- FiniteStateMachine
public abstract class AbstractStateMachine
- extends java.lang.Object
Provides an abstract state machine. Subclasses need to take care of the
state transitions.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractStateMachine
public AbstractStateMachine(State initialState)
getDescription
public java.lang.String getDescription()
getState
public State getState()
setDescription
public void setDescription(java.lang.String description)
setState
public void setState(State newState,
java.lang.String description)
setState
public void setState(State newState)
canChange
protected abstract void canChange(State currentState,
State newState)
- Invoked when a state transition is attempted. Should throw an
exception if transistion is invalid.
stateChanged
protected abstract void stateChanged(State oldState,
State newState)
- Invoked when the state has changed.
Copyright © 2001-2005 XNap Team. All Rights Reserved.