|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.taserv.SMS.SMCompositeState
public class SMCompositeState
Composite state implementation. Composite state is state machine itself. During event handling composite state will pass event to its internal state machine, if not consumed by the internal SM, event will be handled by the state.
| Constructor Summary | |
|---|---|
SMCompositeState(java.lang.Enum stateID)
|
|
SMCompositeState(SMState state)
|
|
| Method Summary | |
|---|---|
void |
_entryTransition()
Performs the state entry transisions, it should not be used or overloaded by user SM. |
void |
_exitTransition()
Performs the state exit transisions, it should not be used or overloaded by user SM. |
void |
addEntryTransition(EntryStateTransition trans)
Adds entry transition to be perfomed every time the state becomes current |
void |
addEntryTransition(java.lang.Object state,
EntryStateTransition trans)
Adds entry transition to the state. |
void |
addExitTransition(ExitStateTransition trans)
Adds exit transition to be perfomed every time other state replaces the state as current |
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.Class triggerEventCls,
StateTransition transition)
Adds transition to the state. |
void |
addTransition(java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
Adds transition to the 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. |
void |
copy(SMStateIF state)
Copies state data such as transitions from the parameter state to the state |
void |
entryTransition()
|
boolean |
equals(java.lang.Object state)
|
void |
exitTransition()
|
SMStateIF |
getCurrentState()
Returns current SM state |
java.util.HashSet<EntryStateTransition> |
getEntryTransitions()
Returns the collection of the defined entry transitions |
java.util.HashMap<java.lang.Class,SMState.TransitionSegment> |
getEventTransitions()
Returns collection of the transistions defined in the state |
java.util.HashSet<ExitStateTransition> |
getExitTransitions()
Returns the collection of the defined exit transitions |
StateTransition |
getLastPerformedTrans()
Returns the last transition performed by the state |
SimpleStateMachineIF |
getSMMachineIF(java.lang.Enum state)
Returns SimpleStateMachineIF interface for the state identified by state Enum |
java.lang.Enum |
getStateID()
Returns the Enum indetifying the state |
java.lang.String |
getStateMachineName()
Returns SM name |
java.lang.String |
getStateName()
Returns state name |
java.util.HashMap<java.lang.Enum,SMStateIF> |
getStates()
Returns states defined in the SM |
boolean |
handleEvent(SMEvent event)
Event passed to the internal SM, the state event handling will not be attempted even if event was not consumed by the internal SM. |
int |
hashCode()
|
void |
removeEntryTransition(EntryStateTransition trans)
Removed entry transition |
void |
removeEntryTransition(java.lang.Object stateObj,
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. |
java.lang.Enum |
stateHandleEvent(SMEvent event)
Event passed to the internal SM, if not consumed by the internal SM, the state handling will be attempted. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SMCompositeState(java.lang.Enum stateID)
public SMCompositeState(SMState state)
throws SMStateCanNotCopy
SMStateCanNotCopy| Method Detail |
|---|
public java.lang.Enum getStateID()
SMStateIF
getStateID in interface SMStateIFpublic java.lang.String getStateName()
SMStateIF
getStateName in interface SMStateIFpublic boolean equals(java.lang.Object state)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
public void addState(java.lang.Enum stateID)
throws SMStateCanNotCopy
SimpleStateMachineIF
addState in interface SimpleStateMachineIFstateID - enum id of the state to be added
SMStateCanNotCopy - Thrown if the new state can not copy existing state into itself
public void addState(SMStateIF state)
throws SMStateCanNotCopy
SimpleStateMachineIF
addState in interface SimpleStateMachineIFstate - state to be added
SMStateCanNotCopy - Thrown if the new state can not copy existing state into itself
public void setCurrentState(SMStateIF state)
throws SMStateNotFound
SimpleStateMachineIF
setCurrentState in interface SimpleStateMachineIFstate - the state to be set current
SMStateNotFound - Thrown if the state does not exist in the SM
public void setCurrentState(java.lang.Enum stateID)
throws SMStateNotFound
SimpleStateMachineIF
setCurrentState in interface SimpleStateMachineIFstateID - enum id of the state to be set current
SMStateNotFound - Thrown if the state does not exist in the SM
public void addTransition(SMStateIF origState,
java.lang.Class triggerEventCls,
StateTransition transition)
throws SMStateCanNotCopy
SimpleStateMachineIF
addTransition in interface SimpleStateMachineIForigState - 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 origState
public void addTransition(SMStateIF origState,
java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
throws SMStateCanNotCopy
SimpleStateMachineIF
addTransition in interface SimpleStateMachineIForigState - 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 origState
public void addTransition(java.lang.Enum origStateEnum,
java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
throws SMStateCanNotCopy
SimpleStateMachineIF
addTransition in interface SimpleStateMachineIForigStateEnum - 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 origState
public void addTransition(java.lang.Enum origStateEnum,
java.lang.Class triggerEventCls,
StateTransition transition)
throws SMStateCanNotCopy
SimpleStateMachineIF
addTransition in interface SimpleStateMachineIForigStateEnum - 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 origState
public void addTransition(java.lang.Class triggerEventCls,
StateTransition transition)
SMStateIF
addTransition in interface SMStateIFtriggerEventCls - the class of the event that will trigger the transitionstransition - the transition object to be added
public void addTransition(java.lang.Class triggerEventCls,
StateTransition transition,
java.lang.Enum newState)
SMStateIF
addTransition in interface SMStateIFtriggerEventCls - the class of the event that will trigger the transitionstransition - the transition object to be addednewState - Enum identifying the new state after performing the transitionpublic boolean handleEvent(SMEvent event)
handleEvent in interface SimpleStateMachineIFevent - event to be handled by SM
public java.lang.Enum stateHandleEvent(SMEvent event)
throws SMStateCanNotHandleEvent
stateHandleEvent in interface SMStateIFevent - the event to be handled
SMStateCanNotHandleEvent - thrown if the state does not have
a transition for the event classpublic StateTransition getLastPerformedTrans()
SMStateIF
getLastPerformedTrans in interface SMStateIF
public void setSMMatrix(java.lang.Object[][] smMatrix)
throws SMBadMatrix,
SMStateCanNotCopy
SimpleStateMachineIF
setSMMatrix in interface SimpleStateMachineIFsmMatrix - 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 state
public void setSMMatrix(java.lang.Object stateObj,
java.lang.Object[][] smMatrix)
throws SMBadMatrix,
SMStateCanNotCopy
SimpleStateMachineIF
setSMMatrix in interface SimpleStateMachineIFstateObj - 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 statepublic void _exitTransition()
SMStateIF
_exitTransition in interface SMStateIFpublic void _entryTransition()
SMStateIF
_entryTransition in interface SMStateIFpublic void entryTransition()
entryTransition in interface SMStateIFpublic void exitTransition()
exitTransition in interface SMStateIFpublic void addEntryTransition(EntryStateTransition trans)
SMStateIF
addEntryTransition in interface SMStateIFtrans - the transition to addpublic void removeEntryTransition(EntryStateTransition trans)
SMStateIF
removeEntryTransition in interface SMStateIFtrans - the transition to removepublic void addExitTransition(ExitStateTransition trans)
SMStateIF
addExitTransition in interface SMStateIFtrans - the transition to add
public void addEntryTransition(java.lang.Object state,
EntryStateTransition trans)
throws SMBadMatrix,
SMStateCanNotCopy
SimpleStateMachineIF
addEntryTransition in interface SimpleStateMachineIFstate - Enum or SMStateIF identifying the statetrans - the entry transition
SMBadMatrix - if state is not Enum or SMStateIF
SMStateCanNotCopy - if can not copy state data
public void removeEntryTransition(java.lang.Object stateObj,
EntryStateTransition trans)
throws SMBadMatrix
SimpleStateMachineIF
removeEntryTransition in interface SimpleStateMachineIFstateObj - Enum or SMStateIF identifying the statetrans - the entry transition
SMBadMatrix - if state is not Enum or SMStateIF
public void addExitTransition(java.lang.Object state,
ExitStateTransition trans)
throws SMBadMatrix,
SMStateCanNotCopy
SimpleStateMachineIF
addExitTransition in interface SimpleStateMachineIFstate - Enum or SMStateIF identifying the statetrans - the exit transition
SMBadMatrix - if state is not Enum or SMStateIF
SMStateCanNotCopy - if can not copy state data
public SimpleStateMachineIF getSMMachineIF(java.lang.Enum state)
throws SMNotCompositeState,
SMStateNotFound
SimpleStateMachineIF
getSMMachineIF in interface SimpleStateMachineIFstate - Enum identifying the state
SMNotCompositeState - if the state is not composite
SMStateNotFound - if the state does not exist
public void copy(SMStateIF state)
throws SMStateCanNotCopy
SMStateIF
copy in interface SMStateIFstate - the state to copy data from
SMStateCanNotCopypublic java.util.HashMap<java.lang.Enum,SMStateIF> getStates()
SimpleStateMachineIF
getStates in interface SimpleStateMachineIFpublic java.util.HashMap<java.lang.Class,SMState.TransitionSegment> getEventTransitions()
SMStateIF
getEventTransitions in interface SMStateIFpublic java.util.HashSet<EntryStateTransition> getEntryTransitions()
SMStateIF
getEntryTransitions in interface SMStateIFpublic java.util.HashSet<ExitStateTransition> getExitTransitions()
SMStateIF
getExitTransitions in interface SMStateIFpublic java.lang.String getStateMachineName()
SimpleStateMachineIF
getStateMachineName in interface SimpleStateMachineIFpublic SMStateIF getCurrentState()
SimpleStateMachineIF
getCurrentState in interface SimpleStateMachineIF
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||