Loop and Conditional Nodes
A Loop Structured Activity Node by default has Setup, Test and Body partitions. The Setup partition is executed once on entry to the Loop, and the Test and Body partitions are executed repeatedly until the Test produces a false value. The results of the final execution of the Test or Body are available after execution of the Loop is complete.
A Conditional Structured Activity Node has a default Clause containing Test and Body partitions. Further Clauses can be added if required.
The two elements are depicted on an Activity diagram as shown below:
You define the Loop or Condition 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 also has a Condition tab, as shown below:
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.
Add an Action Pin for each of the Decider, Loop Variable Input, Loop Variable, Body Output and Result fields for the node, in each case clicking on the Browse or Add button to display the Select Pins dialog (a version of the Select <Item> dialog). The Select ActionPin dialog reveals only Input pins (Loop Variable Input) or 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 the Input pin or an Output pin under the appropriate parent node.
You can also check on the exact location of an existing Action Pin by right-clicking on the pin name and selecting the Find in Project Browser context menu option.
The Nodes panel, by default, lists the Actions and Activities contained in the Setup partition. Click on the Body or Test radio buttons to list the elements contained in the corresponding partitions. An element must be completely contained in a partition to be listed there - if it overlaps with the partition above in any way, it is treated as being part of that partition.