FileDocCategorySizeDatePackage
FSMImpl.javaAPI DocJava SE 5 API2950Fri Aug 26 14:54:38 BST 2005com.sun.corba.se.spi.orbutil.fsm

FSMImpl

public class FSMImpl extends Object implements com.sun.corba.se.spi.orbutil.fsm.FSM
This is the main class that represents an instance of a state machine using a state engine. It may be used as a base class, in which case the guards and actions have access to the derived class.
version
@(#)FSMImpl.java 1.13 03/12/19
author
Ken Cavanaugh

Fields Summary
private boolean
debug
private State
state
private com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl
stateEngine
Constructors Summary
public FSMImpl(com.sun.corba.se.spi.orbutil.fsm.StateEngine se, State startState)
Create an instance of an FSM using the StateEngine in a particular start state.

	this( se, startState, false ) ;
    
public FSMImpl(com.sun.corba.se.spi.orbutil.fsm.StateEngine se, State startState, boolean debug)

	state = startState ;
	stateEngine = (StateEngineImpl)se ;
	this.debug = debug ;
    
Methods Summary
public voiddoIt(com.sun.corba.se.spi.orbutil.fsm.Input in)
Perform the transition for the given input in the current state. This proceeds as follows:

Let S be the current state of the FSM. If there are guarded actions for S with input in, evaluate their guards successively until all have been evaluted, or one returns a non-DISABLED Result.

  1. If a DEFERED result is returned, retry the input
  2. If a ENABLED result is returned, the action for the guarded action is the current action
  3. Otherwise there is no enabled action. If S has a default action and next state, use them; otherwise use the state engine default action (the next state is always the current state).
After the action is available, the transition proceeds as follows:
  1. If the next state is not the current state, execute the current state postAction method.
  2. Execute the action.
  3. If the next state is not the current state, execute the next state preAction method.
  4. Set the current state to the next state.

	stateEngine.doIt( this, in, debug ) ;
    
public StategetState()
Return the current state.

	return state ;
    
public voidinternalSetState(State nextState)

	if (debug) {
	    ORBUtility.dprint( this, "Calling internalSetState with nextState = " +
		nextState ) ;
	}

	state = nextState ;

	if (debug) {
	    ORBUtility.dprint( this, "Exiting internalSetState with state = " +
		state ) ;
	}