Conditional Node

Description

A Conditional Structured Activity Node has a default Clause containing Test and Body partitions. Further Clauses can be added if required.

They are depicted on an Activity diagram as shown below:

condstructact

 
You define Conditional nodes by dragging other Activity diagram elements from the Toolbox page into the appropriate partition of the element, and linking and organizing the structure as required. The elements are aligned on the top left of the partition, so that resizing the node maintains the organization of the structure within and between the partitions. If you try to shrink the node below the structure size, the node automatically defaults to the 'best fit' size.

When you create a Conditional Node, the element Properties dialog displays. Much of this you can complete as for any other element. However, for the Conditional Node the dialog  shows an additional page.

Add an Action Pin as the Result for the node, clicking on the Add button to display the Select Pins dialog (a version of the Select <Item> dialog).

On creation, the Conditional Node automatically has one Clause containing a Decider and Body Output, and a Test partition and a Body partition. You can add further Clauses as required. For each Clause you also add an Action Pin for the Decider and for the Body Output. Click on the Save button to save the Clause definition.

The Select Pin dialog reveals only Output pins as appropriate to the context. If the required Action Pin does not already exist, you can click on the Add New button on the dialog to automatically create an Output pin under the appropriate parent node.

For the Result and Body Output entries, you can check on the exact location of each Action Pin by right-clicking on the entry and selecting the Find in Project Browser context menu option.

The Nodes panel, by default, lists the Actions and Activities contained in the Test partition. Click on the Body radio button to list the elements contained in the Body partition. An element must be completely contained in the Body partition to be listed there - if it overlaps with the Test partition in any way, it is treated as being part of the Test partition.

Add or Remove Clauses

To add another Clause, click on the Add button underneath the Clause(s) list. This inserts a new Clause in the list, and identifies which is the preceding, or Predecessor, Clause and (if appropriate) which is the following, or Successor, Clause. The remaining fields in the Clause(s) panel are cleared to enable you to add Decider and Body Output Action Pins. New Test and Body partitions are immediately added to the element on the diagram, and you can populate these partitions with Activity elements, which are then identified in the Nodes panel.

To remove a Clause, highlight it in the list and click on the Delete button. This immediately removes the Clause's corresponding partitions from the diagram, along with all their contained Activity elements. Removing a Clause from between two other Clauses adjusts the numerical order; for example, if Clause 2 is removed from between Clause 1 and Clause 3,  Clause 3 is renamed as Clause 2, and any further Clauses are also moved up one place.

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.1.1, p.355) states:

A conditional node is a structured activity node that represents an exclusive choice among some number of alternatives.

A conditional node consists of one or more clauses. Each clause consists of a test section and a body section. When the conditional node begins execution, the test sections of the clauses are executed. If one or more test sections yield a true value, one of the corresponding body sections will be executed. If more than one test section yields a true value, only one body section will be executed. The choice is nondeterministic unless the test sequence of clauses is specified. If no test section yields a true value, then no body section is executed; this may be a semantic error if output values are expected from the conditional node.