Class StateEngineImpl
java.lang.Object
com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl
- All Implemented Interfaces:
StateEngine
Encodes the state transition function for a finite state machine.
- Author:
- Ken Cavanaugh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a transition with a guard that always evaluates to true.Add a new transition (old,in,guard,act,new) to the state engine.voidvoiddone()Called after all transitions have been added to the state engine.Create an instance of a FSM that uses this state engine.setDefault(State oldState) Euaivalent to setDefault( oldState, oldState )setDefault(State oldState, Action action, State newState) Set the default transition and action for a state.setDefault(State oldState, State newState) Equivalent to setDefault( oldState, act, newState ) where act is an action that does nothing.voidsetDefaultAction(Action act) Set the default action used in this state engine.
-
Constructor Details
-
StateEngineImpl
public StateEngineImpl()
-
-
Method Details
-
add
public StateEngine add(State oldState, Input input, Guard guard, Action action, State newState) throws IllegalArgumentException, IllegalStateException Description copied from interface:StateEngineAdd a new transition (old,in,guard,act,new) to the state engine. Multiple calls to add with the same old and in are permitted, in which case only a transition in which the guard evaluates to true will be taken. If no such transition is enabled, a default will be taken. If more than one transition is enabled, one will be chosen arbitrarily. This method can only be called before done(). An attempt to call it after done() results in an IllegalStateException.- Specified by:
addin interfaceStateEngine- Throws:
IllegalArgumentExceptionIllegalStateException
-
add
public StateEngine add(State oldState, Input input, Action action, State newState) throws IllegalArgumentException, IllegalStateException Description copied from interface:StateEngineAdd a transition with a guard that always evaluates to true.- Specified by:
addin interfaceStateEngine- Throws:
IllegalArgumentExceptionIllegalStateException
-
setDefault
public StateEngine setDefault(State oldState, Action action, State newState) throws IllegalArgumentException, IllegalStateException Description copied from interface:StateEngineSet the default transition and action for a state. This transition will be used if no more specific transition was defined for the actual input. Repeated calls to this method simply change the default. This method can only be called before done(). An attempt to call it after done() results in an IllegalStateException.- Specified by:
setDefaultin interfaceStateEngine- Throws:
IllegalArgumentExceptionIllegalStateException
-
setDefault
public StateEngine setDefault(State oldState, State newState) throws IllegalArgumentException, IllegalStateException Description copied from interface:StateEngineEquivalent to setDefault( oldState, act, newState ) where act is an action that does nothing.- Specified by:
setDefaultin interfaceStateEngine- Throws:
IllegalArgumentExceptionIllegalStateException
-
setDefault
public StateEngine setDefault(State oldState) throws IllegalArgumentException, IllegalStateException Description copied from interface:StateEngineEuaivalent to setDefault( oldState, oldState )- Specified by:
setDefaultin interfaceStateEngine- Throws:
IllegalArgumentExceptionIllegalStateException
-
done
Description copied from interface:StateEngineCalled after all transitions have been added to the state engine. This provides an opportunity for the implementation to optimize its representation before the state engine is used. This method may only be called once. An attempt to call it more than once results in an IllegalStateException.- Specified by:
donein interfaceStateEngine- Throws:
IllegalStateException
-
setDefaultAction
Description copied from interface:StateEngineSet the default action used in this state engine. This is the action that is called whenever there is no applicable transition. Normally this would simply flag an error. This method can only be called before done(). An attempt to call it after done() results in an IllegalStateException.- Specified by:
setDefaultActionin interfaceStateEngine- Throws:
IllegalStateException
-
doIt
-
makeFSM
Description copied from interface:StateEngineCreate an instance of a FSM that uses this state engine. The initial state of the FSM will be the stateState specified here. This method can only be called after done(). An attempt to call it before done results in an IllegalStateException.- Specified by:
makeFSMin interfaceStateEngine- Throws:
IllegalStateException
-