public abstract class StateParallel extends StateSimple
StateComposite which are executed parallel if this state is active.StateSimple.PlugStateSimpleToGenState, StateSimple.Timeout, StateSimple.Trans, StateSimple.TransChoice, StateSimple.TransJoin| Modifier and Type | Field and Description |
|---|---|
(package private) StateSimple[] |
aParallelstates
Array of all composite states which are executed parallel if this state is active.
|
static java.lang.String |
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 |
|---|
StateParallel()
The constructor of any StateParallel checks the class for inner classes which are the parallel states.
|
StateParallel(java.lang.String stateName,
StateMachine stateMachine,
StateSimple[] aParallelstates)
Special constructor to build a state machine from other data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addState(int key,
StateSimple state)
Special method to build a state machine from other data.
|
(package private) void |
buildStatePathSubstates(StateSimple enclState,
int recurs)
Sets the path to the state for this and all
aParallelstates, recursively call. |
(package private) void |
createTransitionListSubstate(int recurs)
Create all transition list for this state and all
aParallelstates, recursively call. |
java.lang.CharSequence |
infoAppend(java.lang.StringBuilder u)
Appends or returns tan information about the instance.
|
(package private) void |
prepareTransitionsSubstate(int recurs)
Prepare the own transitions.
|
(package private) int |
processEvent(java.util.EventObject evP)
Processes the event for all composite states.
|
java.lang.String |
toString()
Returns the state Id and maybe some more debug information.
|
(package private) int |
XXXentryDefaultState()
This method is used to entry the default state of all parallel composites.
|
(package private) void |
XXXexitTheState(int level)
Exits all actual sub state (and that exits its actual sub state) of all parallel states.
|
_checkTransitions, auxInfo, buildStatePath, checkTrans, compositeState, createTransitionList, enclState, entry, entryTheState, exit, exitTheState, getName, getStatePath, isInState, isTimeout, prepareTransitions, setAuxInfo, setEntryAction, setExitAction, statePathpublic static final java.lang.String version
TransJoin have to be quest in the StateSimple.checkTrans(EventObject) routine.
The transition after the join bar can have a condition or event trigger, which is to quest in the checkTrans.
The automatically transition is removed, because it is not explicitly and cannot have conditions.
Applications should be adapted.
StateComposite, not one of the parallel composites.
It is more simple and logical.
org.vishia.stateMachine.StateAdditionalParallelBase, changed concept:
Nested writing of states, less code, using reflection for missing instances and data.
final StateSimple[] aParallelstates
public StateParallel(java.lang.String stateName,
StateMachine stateMachine,
StateSimple[] aParallelstates)
public StateParallel()
StateComposite is instantiated and stored both in the StateMachine.stateMap
to find all states by its class.hashCode
and in aParallelstates 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(),
StateParallel#buildStatePathSubstates(StateComposite, int),
StateSimple#buildStatePath(StateComposite),
createTransitionListSubstate(int),
StateSimple#createTransitionList()public void addState(int key,
StateSimple state)
void buildStatePathSubstates(StateSimple enclState, int recurs)
aParallelstates, recursively call.
This method is invoked in the constructor of the state machine only one time.buildStatePathSubstates in class StateSimpleenclState - recurs - void createTransitionListSubstate(int recurs)
aParallelstates, 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)
StateSimpleStateCompositeFlat etc
which checks the sub states too.prepareTransitionsSubstate in class StateSimplerecurs - recursion for sub states.final int XXXentryDefaultState()
int processEvent(java.util.EventObject evP)
aParallelstates one after another
invoking its StateComposite.processEvent(EventObject) which calls this method recursively.
StateSimple._checkTransitions(EventObject) of this state is invoked but only if the event is not processed
or the state contains non-event triggered (conditional) transitions. Last one is signified by the StateSimple.modeTrans.
StateSimple.processEvent(EventObject) which is overridden by StateComposite.processEvent(EventObject)
too to provide one method for event processing for all state kinds with the necessary different handling.processEvent in class StateSimpleevP - The event.StateSimpleBase#mEventConsumed as result of the inside called StateSimple._checkTransitions(EventObject).void XXXexitTheState(int level)
StateSimple#exitTheState() which invokes the maybe application overridden StateSimple.exit() routine.public java.lang.CharSequence infoAppend(java.lang.StringBuilder u)
InfoAppendStringBuilder u = new StringBulder(1000); u.append(something_else); myInstance.infoAppend(u); //uses this interface u.append(some_more); System.out.append(u); //output the information String savedInfo = u.toString(); //save permanent.Implementing pattern
QOverride public infoAppend(StringBuilder u) {
if(u == null){ u = new StringBuilder(); } //it can be null!
u.append(special_information).append(": ").append(somewhatElse);
return u;
}
Contiguity with toString: It uses the same information, assembled in a StringBuilder:
QOverride public String toString(){ return infoAppend(null).toString()); }
infoAppend in interface InfoAppendinfoAppend in class StateSimpleu - if not null then the info is appended to u, u is returned.
public java.lang.String toString()
StateSimpletoString in class StateSimpleObject.toString()