com.ibm.etill.framework.supervisor
Class FSM
java.lang.Object
|
+--com.ibm.etill.framework.supervisor.FSM
- public abstract class FSM
- extends Object
FSM is the the base class for FSM classes generated by the JavaGen tool.
This class defines all the methods which must be implemented
by any Finite State Machine. The processEvent method which controls
the flow through any FSM is implemented here. Classes which define
specific FSM logic should extend this class.
Constructor Summary |
FSM()
Cassettes shouldn't call this constructor directly. |
Method Summary |
int |
getState()
Returns the current state of the Finite State Machine. |
Integer |
processEvent(int input)
Defines the flow of control through this Finite State Machine. |
abstract boolean |
validState(int input)
Indicates whether or not the Finite State Machine is in state which can
legitimately expect the given input. |
FSM
public FSM()
- Cassettes shouldn't call this constructor directly. Rather, it will be called
within a constructor chain when the concrete subclass is invoked. This
constructor currently performs no function beyond creating the object.
processEvent
public Integer processEvent(int input)
throws ETillAbortOperation
- Defines the flow of control through this Finite State Machine.
Each call to this method:
- evaluates the input and the input conditions to determine which
row is true,
- changes the state to the "next state" defined in the matrix
- performs the action defined for the current (not next)
state and the true input row. This is accomplished by calling the
action method defined in the matrix.
- Parameters:
input
- is an int value which represents an input event to the FSM.
The inputs will be defined by the designer of the specific
derived FSM.- Returns:
- Integer - A new event value (or null). This event is returned to
the caller of processEvent. If the event is non-null, then
the caller should re-invoke the FSM with it.
- Throws:
ETillAbortOperation
- may be thrown by the action method which
is called to process the event.
validState
public abstract boolean validState(int input)
- Indicates whether or not the Finite State Machine is in state which can
legitimately expect the given input. Note that no processing takes place
when this method is called.
- Parameters:
input
- the int event value to test- Returns:
- boolean
true
if the state expects this input,
false
otherwise.
getState
public int getState()
- Returns the current state of the Finite State Machine.
- Returns:
- int - the current value of the FSM's state variable