Prev Next

Example: Entry and Exit Points (Connection Point References)

Enterprise Architect provides support for Entry and Exit points, and for Connection Point References. In this example, we define two StateMachines for MyClass - StateMachine and SubMachine.

  • State1 is a Composite State (also called an Orthogonal State because it has multiple Regions) with three Regions: RegionA, RegionB and RegionC
  • State2 is a SubMachine State calling SubMachine, which has three Regions: RegionX, RegionY, and RegionZ
  • EntryPoint1 is defined on State1 to activate two of the three Regions; EntryPoint2 is defined on SubMachine to activate two of the three Regions
  • ExitPoint1 is defined on State1; two exit points ExitPoint2 and ExitPoint3 are defined on SubMachine
  • Connection Point References are defined on State2 and bind to the Entry/Exit Points of the typing SubMachine
  • Initial nodes are defined to demonstrate default activation of the Regions

Entering a State: Entry Point Entry

EntryPoint1 on State1

When a Transition targeted on EntryPoint1 is enabled, State1 is activated followed by the contained Regions.

  • Explicit activation occurs for RegionA and RegionB, because each of them is entered by a Transition terminating on one of the Region’s contained Vertices
  • Default activation occurs for RegionC, because it defines an Initial pseudostate InitialC and the Transition originating from the InitialC to StateC1 starts execution

EntryPoint2 on SubMachine

The Trigger Sequence to be simulated is: [EVENT_C, EVENT_A].

When a Transition targeted on Connection Point Reference CPR_Entry on State2 is enabled, State2 is activated, followed by the SubMachine's activation through the binding entry points.

  • Explicit activation occurs for RegionX and RegionY, because each of them is entered by a Transition terminating on one of the Region’s contained Vertices - StateX1 in RegionX, StateY1 in RegionY
  • Default activation occurs for RegionZ, because it defines an Initial pseudostate InitialZ and the Transition originating from InitialZ to StateZ1 starts execution

Entering a State: Default Entry

This situation arises when the Composite State is the direct target of a Transition.

Default Entry of State2

The Trigger Sequence to be simulated is: [EVENT_A, EVENTC].

When a Transition targeted directly on State2 is enabled, State2 is activated, followed by default activation for all the Regions of the SubMachine.

  • RegionX's State is inactive because it does not define an Initial node
  • RegionY is activated through InitialY and the Transition to StateY2 is executed
  • RegionZ is activated through InitialZ and the Transition to StateZ1 is executed

State Exit

State1's Exit

  • Trigger Sequence [EVENT_C, EVENT_A]: RegionC is inactivated first, then RegionA and RegionB; after the exit behavior of State1 is executed, the Transition outgoing from ExitPoint1 is enabled
  • Trigger Sequence [EVENT_A, EVENT_C]: RegionA and RegionB are inactivated first, then RegionC; after the exit behavior of State1 is executed, the Transition outgoing directly from State1 is enabled

State2's Exit

Trigger Sequence [EVENT_C, EVENT_A], so the current state resembles this:

  • Trigger Sequence [EVENT_A, EVENT_C, EVENT_C, EVENT_B, EVENT_B]: RegionX is inactivated first, then RegionY, and RegionZ is the last; after the exit behavior of State2 is executed, the Transition outgoing directly from State2 is enabled
  • Trigger Sequence [EVENT_A, EVENT_B, EVENT_B, EVENT_C, EVENT_C]: RegionX is inactivated first, then RegionZ, and RegionY is the last; after the exit behavior of State2 is executed, the Transition outgoing from CPR_Exit3 is enabled (ExitPoint3 on SubMachine is bound to CPR_Exit3 of State2)
  • Trigger Sequence [EVENT_C, EVENT_C, EVENT_B, EVENT_B, EVENT_A]: RegionY is inactivated first, then RegionZ, and RegionX is the last; after the exit behavior of State2 is executed, the Transition outgoing from CPR_Exit2 is enabled (ExitPoint2 on SubMachine is bound to CPR_Exit2 of State2)