Skip to content

Pseudostates

A pseudostate is an abstraction that encompasses different types of transient vertices in the State Machine.

They are typically used to connect multiple transitions into more complex state transitions paths.

A Pseudostate can never be an active state... therefore

It is either the definition for/pointer to the active state (See: Intial or History States)

or

All transition paths must (after evaluation) end in a state (non Pseudostate) or the State Machine is considdered ill-formed.

Currently the code generation supports the following PseudostateKinds:

Initial

An initial pseudostate represents a default vertex that is the source for a single transition to the default state of a composite state. There can be at most one initial vertex in a region. The outgoing transition from the initial vertex may have a behavior, but not a trigger or guard.

Composite States/Regions

Each region of a composite state may have an initial pseudostate and a final state. A transition to the enclosing state represents a transition to the initial pseudostate in each region. A newly-created object takes its topmost default transitions, originating from the topmost initial pseudostates of each region.

Junction

Junctions are used to chain together multiple transitions. They are used to construct compound transition paths between states.

For example, a junction can be used to converge multiple incoming transitions into a single outgoing transition representing a shared transition path (this is known as a merge).

Conversely, they can be used to split an incoming transition into multiple outgoing transition segments with different guard conditions. This realizes a static conditional branch. (In the latter case, outgoing transitions whose guard conditions evaluate to false are disabled. A predefined guard denoted else may be defined for at most one outgoing transition. This transition is enabled if all the guards labeling the other transitions are false.)

Static conditional branches are distinct from dynamic conditional branches that are realized by Choice Node.

Advantages

When creating compound transitions between states with Junctions all Guard of the transition path needs to evaluate to true before the transitions can be enabled.

Only after this transition path is enabled the Exit Action of the source state will be executed, then all transition effects and at last the Entry Action of the target state will execute. (Transitions without guards are treated as if their guards are always true).

Choice Node

When reached, results in the dynamic evaluation of the guards and triggers of its outgoing transitions. This realizes a dynamic conditional branch.

It allows splitting of transitions into multiple outgoing paths such that the decision on which path to take may be a function of the results of prior actions performed in the same runto-completion step.

If more than one of the guards evaluates to true, an arbitrary one is selected. If none of the guards evaluates to true, then the model is considered ill-formed. (To avoid this, it is recommended to define one outgoing transition with the predefined else guard for every choice vertex.)

Choice vertices should be distinguished from static branch points that are based on Junctions.

Deep History

Using a deep history state in a composite state will reactivate the previously active state (prior to the exit from the composite state) on the same region/level/composite state the history state and also in all nested states at any depth.

History

Diagram description

If, for example State13_2 is active and the SignalTrigger is fired, State11, State13 and State13_2 will be exited and State16 will be entered/activated. After this State16 will enable the default transition to the history and therefore reactivating State11, State13 and State13_2.

Shallow History

Using a shallow history state in a composite state will reactivate the previously active state (prior to the exit from the composite state) on the same region/level/composite state the history state is in.

History

Diagram description

If, for example State13 is active and the SignalTrigger is fired, State11 and State13 will be exited and State16 will be entered/activated. After this State16 will enable the default transition to the history and therefore reactivating State11 and State13.

Entry/Exit nodes

An entry pseudostate is used to join an external transition terminating on that entry point to an internal transition emanating from that entry point. An exit pseudostate is used to join an internal transition terminating on that exit point to an external transition emanating from that exit point. The main purpose of such entry and exit points is to execute the state entry and exit actions respectively in between the actions that are associated with the joined transitions.

Entry point

If a transition enters a composite state through an entry point pseudostate, then the entry behavior is executed before the action associated with the internal transition emanating from the entry point.

Exit point

An exit point pseudostate is an exit point of a state machine or composite state. Entering an exit point within any region of the composite state or state machine referenced by a submachine state implies the exit of this composite state or submachine state and the triggering of the transition that has this exit point as source in the state machine enclosing the submachine or composite state.

Restrictions

Consider the submachine restrictions.

Entry Exit point

With this example state machine we will show the order of execution using entry/exit points:

  1. The effect of the transition from: State24 entry point
  2. entry action of State25
  3. The effect of the transition from: entry point State27
  4. entry action of State27
  5. exit action of State27
  6. The effect of the transition from: State27 exit point
  7. exit action of State25
  8. The effect of the transition from: exit point State26