|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SimpleStateMachineIF
Defines contract for manipulating state machine(SM) behavior definitions and SM scheduling. All state machines and composite states implement this interface.
Method Summary | |
---|---|
void |
addEntryTransition(java.lang.Object state,
EntryStateTransition trans)
Adds entry transition to the state. |
void |
addExitTransition(java.lang.Object state,
ExitStateTransition trans)
Adds exit transition to the state. |
void |
addState(java.lang.Enum stateID)
Adds new state to SM or replaces existing state. |
void |
addState(SMStateIF state)
Adds new state to SM or replaces existing state. |
void |
addTransition(java.lang.Enum origStateEnum,
java.lang.Class triggerEventCls,
StateTransition transition)
Adds new transition to the SM or replaces existing transition identified by the origStateEnum and the event class. |
void |
addTransition(java.lang.Enum origStateEnum,
java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
Adds new transition to the SM or replaces existing transition identified by the origStateEnum and the event class. |
void |
addTransition(SMStateIF origState,
java.lang.Class triggerEventCls,
StateTransition transition)
Adds new transition to the SM or replaces existing transition identified by the origState and the event class. |
void |
addTransition(SMStateIF origState,
java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
Adds new transition to the SM or replaces existing transition identified by the origState and the event class. |
SMStateIF |
getCurrentState()
Returns current SM state |
SimpleStateMachineIF |
getSMMachineIF(java.lang.Enum state)
Returns SimpleStateMachineIF interface for the state identified by state Enum |
java.lang.String |
getStateMachineName()
Returns SM name |
java.util.HashMap<java.lang.Enum,SMStateIF> |
getStates()
Returns states defined in the SM |
boolean |
handleEvent(SMEvent event)
Entry point for SM event handling. |
void |
removeEntryTransition(java.lang.Object state,
EntryStateTransition trans)
Removes entry transition. |
void |
setCurrentState(java.lang.Enum stateID)
Sets current SM state to the state identified by stateID |
void |
setCurrentState(SMStateIF state)
Sets current SM state to the state |
void |
setSMMatrix(java.lang.Object[][] smMatrix)
Adds states and transitions identified by smMatrix to the SM. |
void |
setSMMatrix(java.lang.Object stateObj,
java.lang.Object[][] smMatrix)
Adds states and transitions identified by smMatrix to the state identified by stateObj. |
Method Detail |
---|
boolean handleEvent(SMEvent event)
SM scheduler
to dispatch events to target SM.
This method dispatches the event to the current SM state and if the state
consumes the event, updates SM current state according to the state
returned value. If the returned value is NULL, the current state does not change.
event
- event to be handled by SM
void addState(SMStateIF state) throws SMStateCanNotCopy
state
- state to be added
SMStateCanNotCopy
- Thrown if the new state can not copy existing state into itselfvoid addState(java.lang.Enum stateID) throws SMStateCanNotCopy
stateID
- enum id of the state to be added
SMStateCanNotCopy
- Thrown if the new state can not copy existing state into itselfvoid setCurrentState(SMStateIF state) throws SMStateNotFound
state
- the state to be set current
SMStateNotFound
- Thrown if the state does not exist in the SMvoid setCurrentState(java.lang.Enum stateID) throws SMStateNotFound
stateID
- enum id of the state to be set current
SMStateNotFound
- Thrown if the state does not exist in the SMvoid addTransition(SMStateIF origState, java.lang.Class triggerEventCls, StateTransition transition) throws SMStateCanNotCopy
origState
- the originating state of the transitiontriggerEventCls
- the class of the event that should trigger the transitiontransition
- the transition that will be preformed during handling
of the triggerEvent assuming the current state is origState
SMStateCanNotCopy
- Thrown if the state identified by origState.stateID
existed in the SM and was not equal to the origState and the existed state
data can not be copied into the origStatevoid addTransition(SMStateIF origState, java.lang.Class triggerEventCls, StateTransition transition, java.lang.Enum newState) throws SMStateCanNotCopy
origState
- the originating state of the transitiontriggerEventCls
- the class of the event that should trigger the transitiontransition
- the transition that will be preformed during handling
of the triggerEvent assuming the current state is origStatenewState
- enum id of the state to set current after execution of the
transition if the return value of the transition is NULL
SMStateCanNotCopy
- Thrown if the state identified by origState.stateID
existed in the SM and was not equal to the origState and the existed state
data can not be copied into the origStatevoid addTransition(java.lang.Enum origStateEnum, java.lang.Class triggerEventCls, StateTransition transition) throws SMStateCanNotCopy
origStateEnum
- the originating state of the transitiontriggerEventCls
- the class of the event that should trigger the transitiontransition
- the transition that will be preformed during handling
of the triggerEvent assuming the current state is origState
SMStateCanNotCopy
- Thrown if the state identified by origState.stateID
existed in the SM and was not equal to the origState and the existed state
data can not be copied into the origStatevoid addTransition(java.lang.Enum origStateEnum, java.lang.Class triggerEventCls, StateTransition transition, java.lang.Enum newState) throws SMStateCanNotCopy
origStateEnum
- the originating state of the transitiontriggerEventCls
- the class of the event that should trigger the transitiontransition
- the transition that will be preformed during handling
of the triggerEvent assuming the current state is origStatenewState
- enum id of the state to set current after execution of the
transition if the return value of the transition is NULL
SMStateCanNotCopy
- Thrown if the state identified by origState.stateID
existed in the SM and was not equal to the origState and the existed state
data can not be copied into the origStatevoid setSMMatrix(java.lang.Object[][] smMatrix) throws SMBadMatrix, SMStateCanNotCopy
smMatrix
- transitions matrix identifying the behavior of the SM.
The matrix should have the following format:
{ { state <Enum or SMStateIF>, eventClass<Class>, transitionObject<StateTransition>, newState <Enum>}, { state1 <Enum or SMStateIF>, eventClass1<Class>, transitionObject1<StateTransition>, newState1 <Enum>}, … }
SMBadMatrix
- if smMatrix format does not comform to the above format
SMStateCanNotCopy
- if one of the states has to be replaced and the
existing state data could not be copied to the new statevoid setSMMatrix(java.lang.Object stateObj, java.lang.Object[][] smMatrix) throws SMBadMatrix, SMStateCanNotCopy
stateObj
- Enum or SMStateIF identifying the state that should have
behavior identified by smMatrixsmMatrix
- transitions matrix identifying the behavior of the state
identified by stateObj
The matrix should have the following format:
{ { state <Enum or SMStateIF>, eventClass<Class>, transitionObject<StateTransition>, newState <Enum>}, { state1 <Enum or SMStateIF>, eventClass1<Class>, transitionObject1<StateTransition>, newState1 <Enum>}, … }
SMBadMatrix
- if smMatrix format does not comform to the above format
or stateObj is not Enum or SMStateIF
SMStateCanNotCopy
- if one of the states has to be replaced and the
existing state data could not be copied to the new statevoid addEntryTransition(java.lang.Object state, EntryStateTransition trans) throws SMBadMatrix, SMStateCanNotCopy
state
- Enum or SMStateIF identifying the statetrans
- the entry transition
SMBadMatrix
- if state is not Enum or SMStateIF
SMStateCanNotCopy
- if can not copy state datavoid removeEntryTransition(java.lang.Object state, EntryStateTransition trans) throws SMBadMatrix
state
- Enum or SMStateIF identifying the statetrans
- the entry transition
SMBadMatrix
- if state is not Enum or SMStateIFvoid addExitTransition(java.lang.Object state, ExitStateTransition trans) throws SMBadMatrix, SMStateCanNotCopy
state
- Enum or SMStateIF identifying the statetrans
- the exit transition
SMBadMatrix
- if state is not Enum or SMStateIF
SMStateCanNotCopy
- if can not copy state dataSimpleStateMachineIF getSMMachineIF(java.lang.Enum state) throws SMNotCompositeState, SMStateNotFound
state
- Enum identifying the state
SMNotCompositeState
- if the state is not composite
SMStateNotFound
- if the state does not existjava.util.HashMap<java.lang.Enum,SMStateIF> getStates()
java.lang.String getStateMachineName()
SMStateIF getCurrentState()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |