Composite state

A composite state is an element of a state machine that does have substates (it contains one or more regions and can contain certain pseudostates). It is processed when it is reached by an incoming transition.The root state of a state machine is also a composite state.

A composite state belongs to a region.

Symbol

images/download/attachments/2785297/composite_state_symbol.png

A composite state is shown as a rectangle with rounded corners and with a header on the upper side. The regions that are contained by the composite state are delimited by a dashed line.

Symbol in context

images/download/attachments/2785297/composite_state_symbol_context_2.png

  • 'Composite state 1' is entered and becomes active (via the transition emanating from the outer initial pseudostate).

  • 'Simple state 1' and 'Simple state 2' are entered and become active (via the transitions emanating from the inner initial pseudostates).

  • The final states are reached, both regions are finished (completed) and thus 'Composite state 1' is finished.

Characteristics

  • A composite state contains one or more regions. A composite state with more than one region is an orthogonal state.

  • A composite state can contain entry points, exit points and at most one deep history and/or one shallow history.

  • A composite state is finished when all its regions are finished.

  • A state machine has a composite state as its root state.

  • A composite state can have entry and exit behaviors but no 'do' behavior.

  • A composite state can defer events.

Interpretation of and deviation from the UML specification

UML specification

  1. A composite state contains one or more regions.

  2. "An optional behavior that is executed while being in the state. The execution starts when this state is entered, and stops either by itself or when the state is exited whichever comes first." [ p.561 ].

yasmine deviation

  1. A composite state contains one or more regions, entry points, exit points and at most one shallow history and/or one deep history.

  2. A composite state has no 'do' behavior.

Rationale

  1. In yasmine states own their entry and exit points as well as their histories. Entry and exit points belong to a state (as they enter and exit a state). History pseudostates will be assigned to regions in a future version of yasmine, because the current implementation is opposed to the definition in the specification.

  2. The specification does not mention what kind of state can have a do behavior. Thus basically every state (also a composite state!) could have a do behavior. As a composite state's "behavior" is defined by its child states, it does not make sense to us, that the composite state should have a do behavior of its own.