public abstract class StateCompositeFlat extends StateSimple implements InfoAppend
StateComposite.
Therefore it can use the state variable of its enclosing StateComposite. A composite state has two core properties:
StateComposite.processEvent(java.util.EventObject)
which checks whether the state StateComposite.stateAct refers a StateSimple.enclState as StateCompositeFlat.
Then its transitions are checked after checking the transitions of the actual state.
StateComposite because it provides half of its properties.
The top state or a composite state inside a StateParallel should be of type StateComposite because
it needs a StateComposite.stateAct to control the state processing.StateSimple.PlugStateSimpleToGenState, StateSimple.Timeout, StateSimple.Trans, StateSimple.TransChoice, StateSimple.TransJoin| Modifier and Type | Field and Description |
|---|---|
(package private) StateSimple[] |
aSubstates
List of all sub states of this composite state.
|
(package private) StateSimple |
stateDefault |
static int |
version
Version, history and license.
|
compositeState, ctEntry, dateLastEntry, durationLast, enclState, entry, evTimeout, exit, ixCompositeState_inStatePath, mEventConsumed, mEventDonotRelinquish, mEventNotConsumed, millisectimeout, modeTrans, mRunToComplete, mStateEntered, mStateLeaved, mTransit, notTransit, stateId, stateMachine, statePath, transTimeout| Constructor and Description |
|---|
StateCompositeFlat()
The constructor of any StateComposite checks the class for inner classes which are the states.
|
StateCompositeFlat(java.lang.String name,
StateMachine stateMachine,
StateSimple[] aSubstates)
Only used for the
StateMachine.stateTop
and as special constructor to build a state machine from other data. |
| Modifier and Type | Method and Description |
|---|---|
void |
addState(int key,
StateSimple state)
It is called from outside if the state machine is build other than with Reflection.
|
(package private) void |
buildStatePathSubstates(StateSimple enclState,
int recurs)
Sets the path to the state for this and all
aSubstates, recursively call. |
(package private) void |
createTransitionListSubstate(int recurs)
Create all transition list for this state and all
aSubstates, recursively call. |
(package private) int |
entryDefaultState()
This method is used to entry the default state of this composite if the actual state is null (first invocation).
|
(package private) void |
prepareTransitionsSubstate(int recurs)
Prepare all transitions for this state and all
aSubstates, recursively call. |
StateSimple |
stateDefault() |
_checkTransitions, auxInfo, buildStatePath, checkTrans, compositeState, createTransitionList, enclState, entry, entryTheState, exit, exitTheState, getName, getStatePath, infoAppend, isInState, isTimeout, prepareTransitions, processEvent, setAuxInfo, setEntryAction, setExitAction, statePath, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinfoAppendpublic static final int version
StateComposite.
Reason: Too many recursions while using StateComposite, not well for debugging.
States in C should not use one state variable per composite if it is not necessary. A own state variable
per composite state is only necessary if the composite should store a history state.
StateSimple stateDefault
final StateSimple[] aSubstates
public StateCompositeFlat(java.lang.String name,
StateMachine stateMachine,
StateSimple[] aSubstates)
StateMachine.stateTop
and as special constructor to build a state machine from other data. See org.vishia.stateMGen.StateMGen.public StateCompositeFlat()
StateSimple is instantiated and stored both in the StateMachine.stateMap
to find all states by its class.hashCode
and in aSubstates for debugging only.
#buildStatePathSubstates() is invoked to store the state path in all states.
Then createTransitionListSubstate(int) is invoked which checks the transition of all states recursively.
Therewith all necessary data for the state machines's processing are created on construction.StateMachine#StateMachine(),
StateComposite#buildStatePathSubstates(StateComposite, int),
StateSimple#buildStatePath(StateComposite),
createTransitionListSubstate(int),
StateSimple#createTransitionList()public void addState(int key,
StateSimple state)
key - the key which is used to find the state in StateMachine.stateMap while preparing the transitionsstate - a new inner state.public StateSimple stateDefault()
void buildStatePathSubstates(StateSimple enclState, int recurs)
aSubstates, recursively call.
This method is invoked in the constructor of the state machine only one time.
It is not for application.buildStatePathSubstates in class StateSimpleenclState - recurs - void createTransitionListSubstate(int recurs)
aSubstates, recursively call.
This method is invoked in the constructor of the state machine only one time.
It is not for application.createTransitionListSubstate in class StateSimplerecurs - void prepareTransitionsSubstate(int recurs)
aSubstates, recursively call.
This method is invoked in the constructor of the state machine only one time.
It is not for application.prepareTransitionsSubstate in class StateSimplerecurs - final int entryDefaultState()