Reputation: 1834
I am in need of identifying all the basic elements of a UML 2.5 State Machine Diagram. Unfortunately , there seems to be a lot of ambiguity on the notation of those diagrams, as there are a lot of different variations online.
My interpretation is that every state machine diagram , consists of a number of states and a number of transitions.
Every state has:
Every transition has:
My understanding of how the notation works can be summarized in Figure 1 (example of an electric door functionality following the notation [precondition] Event / [Transition Action]) and in Figure 2.
Example: When an event is triggered (e.g close button pressed), the precondition (if any) is evaluated (e.g is the doorway empty) and if the precondition is satisfied, a transition action (e.g close door) is triggered.
My questions:
I know that there a dozen of variations of state machine diagrams, hence the different representations / interpretations but i am interested on the UML 2.5 one.
Upvotes: 2
Views: 1739
Reputation: 36313
The Transition Action is what UML 2.5 states as association end of a transition:
effect : Behavior [0..1]{subsets Element::ownedElement} (opposite A_effect_transition::transition) Specifies an optional behavior to be performed when the Transition fires.
While the <<entry>>
of a state is a behavior assigned to the state itself. That is, it will be triggered from where ever the transition comes from. In contrast the above effect is only trigger along the transition.
The effect can not "go wrong". What ever behavior is performed, is performed. No condition is checked here.
Whether a transition is triggered can be controlled by the [guard]
which you wrongly named [precondition]
. (One can start arguing, but you need to go with [guard]
.)
guard : Constraint [0..1]{subsets Namespace::ownedRule} (opposite A_guard_transition::transition) A guard is a Constraint that provides a fine-grained control over the firing of the Transition. The guard is evaluated when an Event occurrence is dispatched by the StateMachine. If the guard is true at that time, the Transition may be enabled, otherwise, it is disabled. Guards should be pure expressions without side effects. Guard expressions with side effects are ill formed.
With respect to timing you can think of a token traveling along the states. When the guard lets you pass, the <<exit>>
behavior is performed. Then the transition's effect
and finally the <<entry>>
behavior of the next state.
Upvotes: 2