Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Deferred Event Pattern
Enterprise Architect supports the Deferred Event pattern.
To create a Deferred Event in a State:
- Create a self transition for the State.
- Change the 'kind' of the transition to 'internal'.
- Specify the Trigger to be the event you want to defer.
- In the 'Effect' field, type 'defer();'.
To Simulate:
From the main menu, select 'Analyzer | Simulator | Open Simulator and Simulator Event Window'.
The Simulator Events window allows you to trigger events by double clicking on a trigger in the 'Waiting Triggers' column.
The Simulation window shows the execution in text. You can type 'dump' in the Simulator command line to show how many events are deferred in the queue; it might resemble this:
[24850060] Event Pool: [NEW,NEW,NEW,NEW,NEW,]
Deferred Event Example
This example shows a model using deferred events, along with the Simulation Events window showing all available Events.
This text is from the output in the Simulator window when running. Green text indicates user input or operation.
Click Run
[13389627] client[TestClient].Initial_267__TO__State1_117 Effect
[13389629] client[TestClient].StateMachine_State1 ENTRY
[13389632] client[TestClient].StateMachine_State1 DO
[13389634] server[TransactionServer].Initial_89__TO__idle_34 Effect
[13389637] server[TransactionServer].StateMachine_idle ENTRY
[13389639] server[TransactionServer].StateMachine_idle DO
[13390560] Blocked
Trigger 'RUN_TEST'
[13393274] client[TestClient].StateMachine_State1 EXIT
[13393279] client[TestClient].State1__TO__State2_118 Effect
[13393284] client[TestClient].StateMachine_State2 ENTRY
[13393288] client[TestClient].StateMachine_State2 DO
[13393293] server[TransactionServer].StateMachine_idle EXIT
[13393298] server[TransactionServer].idle__TO__busy_35 Effect
[13393303] server[TransactionServer].StateMachine_busy ENTRY
[13393307] server[TransactionServer].StateMachine_busy DO
[13394278] Blocked
Trigger 'RUN_TEST'
[13394472] client[TestClient].StateMachine_State2 EXIT
[13394474] client[TestClient].State2__TO__State3_119 Effect
[13394476] client[TestClient].StateMachine_State3 ENTRY
[13394479] client[TestClient].StateMachine_State3 DO
[13395483] Blocked
Type "dump"
[13397882] state/initial active count for client[TestClient]:
2 TestClient_VIRTUAL_SUBMACHINESTATE NOSTATE
0 TestClient_StateMachine_State1 TestClient_VIRTUAL_SUBMACHINESTATE
0 TestClient_StateMachine_State2 TestClient_VIRTUAL_SUBMACHINESTATE
1 TestClient_StateMachin
[13397898] state/initial active count for server[TransactionServer]:
2 TransactionServer_VIRTUAL_SUBMACHINESTATE NOSTATE
0 TransactionServer_StateMachine_idle TransactionServer_VIRTUAL_SUBMACHINESTATE
1 TransactionServer_StateMachine_busy TransactionServer_VIRTUAL_SUB
[13397912] Event Pool: [NEW_REQUEST,]
[13398137] Blocked
Trigger 'RUN_TEST'
[13501367] client[TestClient].StateMachine_State3 EXIT
[13501369] client[TestClient].State3__TO__State4_120 Effect
[13501371] client[TestClient].StateMachine_State4 ENTRY
[13501374] client[TestClient].StateMachine_State4 DO
[13502369] Blocked
Type "dump"
[13531849] state/initial active count for client[TestClient]:
2 TestClient_VIRTUAL_SUBMACHINESTATE NOSTATE
0 TestClient_StateMachine_State1 TestClient_VIRTUAL_SUBMACHINESTATE
0 TestClient_StateMachine_State2 TestClient_VIRTUAL_SUBMACHINESTATE
0 TestClient_StateMachin
[13531864] state/initial active count for server[TransactionServer]:
2 TransactionServer_VIRTUAL_SUBMACHINESTATE NOSTATE
0 TransactionServer_StateMachine_idle TransactionServer_VIRTUAL_SUBMACHINESTATE
1 TransactionServer_StateMachine_busy TransactionServer_VIRTUAL_SUB
[13531878] Event Pool: [NEW_REQUEST,NEW_REQUEST,]
[13532090] Blocked
Trigger 'RUN_TEST'
[13554546] client[TestClient].StateMachine_State4 EXIT
[13554550] client[TestClient].State4__TO__State5_121 Effect
[13554553] client[TestClient].StateMachine_State5 ENTRY
[13554554] client[TestClient].StateMachine_State5 DO
[13554555] server[TransactionServer].StateMachine_busy EXIT
[13554556] server[TransactionServer].busy__TO__idle_36 Effect
[13554557] server[TransactionServer].StateMachine_idle ENTRY
[13554558] server[TransactionServer].StateMachine_idle DO
[13555281] client[TestClient].StateMachine_State5 EXIT
[13555287] client[TestClient].State5__TO__Final_272_124 Effect
[13555290] server[TransactionServer].StateMachine_idle EXIT
[13555292] server[TransactionServer].idle__TO__busy_35 Effect
[13555294] server[TransactionServer].StateMachine_busy ENTRY
[13555295] server[TransactionServer].StateMachine_busy DO
[13556420] Blocked
Type "dump"
[13582884] state/initial active count for client[TestClient]:
[13582892] state/initial active count for server[TransactionServer]:
2 TransactionServer_VIRTUAL_SUBMACHINESTATE NOSTATE
0 TransactionServer_StateMachine_idle TransactionServer_VIRTUAL_SUBMACHINESTATE
1 TransactionServer_StateMachine_busy TransactionServer_VIRTUAL_SUB
[13582901] Event Pool: [NEW_REQUEST,]
[13582935] Blocked