keezar
keezar

Reputation: 89

UML state machine - explicit entry in composite state with entry activity

i have got a question regarding the UML state machine diagram.

From the UML 2.5 specs, "14.2.3.4.5 Entering a State", p. 307f.

Explicit entry: If the incoming Transition or its continuations terminate on a directly contained substate of the composite State, then that substate becomes active and its entry Behavior is executed after the execution of the entry Behavior of the containing composite State. This rule applies recursively if the Transition terminates on an indirect (deeply nested) substate.

Let e be our explicit entry, this means for the given situation that the entry activity of A1 (which is x) is executed before the entry activity of A (which is y), right? Or is it the other way round?

Diagram

Thanks.

Upvotes: 2

Views: 251

Answers (2)

bruno
bruno

Reputation: 32596

Let e be our explicit entry, this means for the given situation that the entry activity of A1 (which is x) is executed before the entry activity of A (which is y), right? Or is it the other way round?

no, this is the reverse ( its entry Behavior is executed after the execution of the entry Behavior of the containing composite State) so x is executed after y

This is logical, you enter in A before to enter in A1 (you enter in the building before to enter in an apartment into the building). On exit this is of course the reverse, you exit from A1 before to exit from A

Upvotes: 4

Ister
Ister

Reputation: 6318

The substate entry activity is run after the containing state entry activity completes. So the outermost state entry activity is run first and the innermost last.

So if we have states x, y, z, where x contains y and y contains z and Ax, Ay and Az are entry activities of x, y and z respectively then when the transition terminates on z, the execution order is Ax => Ay => Az.

Note, exit activities are performed in the opposite order (innermost state first, outermost last)

Upvotes: 3

Related Questions