UML Diagrams Zicomi Systems publishes some UML example diagrams online from the world famous UML dictionary. more...
Version 2.5 Released Zicomi Systems is delighted to announce that version 2.5 of Zicomi Mentor is released. With support for UML 2.0 and all thirteen UML diagrams more...
Zicomi Systems' Director speaks about the UML at Objects by Design - an informative interview more...
Partner Programme Zicom Systems is delighted to announce a new world wide partner programme, become a partner today. more...
OMG Member Zicom Systems is made a member of the OMG!
Alternatives (Combined Fragment)
An alternatives interaction operator (signified by the value of alt) defines a combined fragment where one or more behavior options or choices are expressed. One (and only one) of the alternatives (operands) can execute and only when the guard condition evaluates to TRUE.
Explanation
The alternatives operator is used to define a number of choices. The choices (operands) are guarded with conditions that determine whether the messages enclosed in the operand will execute. There may be any number of choices, all of which have mutually exclusive guard conditions, but only one of the choices can execute and only if the condition that is guarding the operand is TRUE. If an else condition is defined it will fire if (and only if) all other guards evaluate to FALSE. In our everyday life we often come across this concept when for example: depending on factors like price and urgency we may choose to take an express, fast or local train. At a programming level this could be represented by an if <condition> then else or a case statement.
A combined fragment with an operator of option (opt) is related to a combined fragment with an operator of alternatives (alt) because the option can express a single operand defining a set of messages, whereas the alternatives has the possibility of defining a number of different choices (operands). The two operands alternatives and option are semantically equivalent in the circumstance that the alt operand defines a single operand with an else operand that contains no messages.