Search code examples
umlstate-machinestatechartboost-statechart

UML state charts: completion transitions


In the context of UML state charts with the run-to-completion model, how are "completion transitions" processed?

  1. The completion of a state inserts a "completion event" at the beginning of the event queue and the "completion transition" is thus only executed then the state machine is explicitly stepped, OR
  2. completion of a state immediately triggers the "completion transition" (and possibly subsequent "completion transitions") and the state machine thus may execute multiple steps for each explicit stepping.

Both cases suggest, that a state's unguarded "completion transition" effectively makes any other defined transitions (whether event-triggered or guarded) redundant.

Am I understanding this correctly?


Solution

  • The answer is closer to #2 ('completion of a state immediately triggers the "completion transition"'), but you then mention "multiple steps for each explicit stepping." I don't know what you mean by that.

    The UML 2.5 spec, in section 14.2.38.3, says:

    A special kind of Transition is a completion Transition, which has an implicit trigger. The event that enables this trigger is called a completion event and it signifies that all Behaviors associated with the source State of the completion Transition have completed execution. In case of simple States, a completion event is generated when the associated entry and doActivity Behaviors have completed executing. If no such Behaviors are defined, the completion event is generated upon entry into the State.

    The spec goes on to describe how a completion event is generated for composite or submachine states. Since you're asking about this simpler case, I'll skip that.

    The spec also says "Completion events have dispatching priority. That is, they are dispatched ahead of any pending Event occurrences in the event pool." Thus, other defined transitions are not dispatched.