Does BoUML' State Machine generator handle exit and entry into a compound state correctly?

Viewed 63

Consider the following History state machine:

enter image description here

When the code below is run ...

  machine.create();
  machine.check();
  machine.stop();

machine generates the following output:

01 DEBUG : current state is now .History.Outer
02 DEBUG : execute entry behavior of .History.Outer
03 Entry behavior Outer
04 DEBUG : current state is now .History.Outer.Inner
05 DEBUG : execute entry behavior of .History.Outer.Inner
06 Entry behavior Inner
07 DEBUG : fire trigger check
08 DEBUG : execute exit behavior of .History.Outer
09 Exit behavior Outer
10 DEBUG : current state is now .History
11 DEBUG : current state is now .History.Outer
12 DEBUG : fire trigger stop
13 DEBUG : execute exit behavior of .History.Outer
14 Exit behavior Outer
15 DEBUG : current state is now .History
16 DEBUG : final state reached

I see two issues with this output.First, according to the UML specification, paragraph 14.2.3.4.6 Exiting a State

When exiting from a composite State, exit commences with the innermost State in the active state configuration. This means that exit Behaviors are executed in sequence starting with the innermost active State.

But after trigger check is fired (line 07), only Outer's state exit behavior is executed (lines 08 and 09). Exit behaviour of Inner never executes.

Second, according to paragraph 14.2.3.4.4 State History

Deep history ( deepHistory ) represents the full state configuration of the most recent visit to the containing Region. The effect is the same as if the Transition terminating on the deepHistory Pseudostate had, instead, terminated on the innermost State of the preserved state configuration, including execution of all entry Behaviors encountered along the way.

Thus I would expect to see a copy of lines 02-06 after line 11.

Am I right?

1 Answers

The state machine generator is just a demonstrator of a class generator/model transformation. It only manages trivial state machine, as you can see after you applied it there is no inner class generated to support the inner state, and nothing is done for historic state nor region, pseudo state ...

It is a plug-out, it is not part of the modeler (BoUML executable), so you are free to improve or completely rewrite it for your own. This is the raison d'ĂȘtre of the plug-outs, to allow you to not be limited by the features I deliver.

Related