Choice

Return to Introduction  Previous page  Next page

d_Choice

The Choice pseudo-state is used to compose complex transitional paths in, for example, a State Machine diagram, where the outgoing transition path is decided by dynamic, run-time conditions. The run-time conditions are determined by the actions performed by the State Machine on the path leading to the choice. 

The following example depicts the Choice element. Upon reaching the Filter pseudo-state, a transition fires to the appropriate state based on the run-time value passed to the Filter. Very similar in form to a Junction pseudo-state, the Choice pseudo-state's distinction is in deciding transition paths at run-time. 

State -- Choice

Toolbox Icon

e_Choice

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.0, p. 471) states:

"...choice vertices which, when reached, result in the dynamic evaluation of the guards of the triggers of its outgoing transitions. This realizes a dynamic conditional branch. It enables splitting of transitions into multiple outgoing paths such that the decision on which path to take may be a function of the results of prior actions performed in the same run-to-completion step. If more than one of the guards evaluates to true, an arbitrary one is selected. If none of the guards evaluates to true, then the model is considered ill-formed. (To avoid this, it is recommended to define one outgoing transition with the predefined "else" guard for every choice vertex.) Choice vertices should be distinguished from static branch points that are based on junction points."