Search code examples
umlstatechart

Composite state and internal transitions


Provided I am in StateB now. Sig2 comes. So no entry or exit will be executed, but only Act5. So far so good.

Now we are in StateC, but this time Sig1 comes. There is an internal transition defined, but in the parent composite state. Do I have to exit from StateC, do the Act2 and go to the initial connector and enter StateB?

I did not find answer to this question in the UML standard.

State machine


Solution

  • You don't need to exit StateC, internal transitions of an owning state can always occur as long as you are in some of it's substates.

    14.5.12.3 Literals

    • internal
      • Implies that the Transition, if triggered, occurs without exiting or entering the source State (i.e., it does not cause a state change). This means that the entry or exit condition of the source State will not be invoked. An internal Transition can be taken even if the SateMachine is in one or more Regions nested within the associated State.

    This makes sense --- you are always in some substate of a composite state. (Once you enter a composite state it immediately (after entry behavior) goes to the first state).

    And of course internal transitions do not change state configuration, so it will remain the same (<StateA::StateC>).

    This all is of course assuming that you teleported into StateC, because that state is unreachable.