Previous UML Classes Table of Contents UML Packages Next


12.3.18 ConditionalNode

CompleteStructuredActivities , StructuredActivities


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

*Generalizations

   StructuredActivityNode (from CompleteStructuredActivities , StructuredActivities) on page 425

*Description

   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.

Issue 8685 -replace ‘result’ with ‘clause execution order’

   In general, test section may be executed in any order, including simultaneously (if the underlying execution architecture supports it). The result may therefore be nondeterministic if more than one test section can be true concurrently. To enforce ordering of evaluation, sequencing constraints may be specified among clauses. One frequent case is a total ordering of clauses, in which case the clause execution order is determinate. If it is impossible for more than one test section to evaluate true simultaneously, the result is deterministic and it is unnecessary to order the clauses, as ordering may impose undesirable and unnecessary restrictions on implementation. Note that, although evaluation of test sections may be specified as concurrent, this does not require that the implementation evaluate them in parallel; it merely means that the model does not impose any order on evaluation.

Issue 8499 -remove last sentence

   An else clause is a clause that is a successor to all other clauses in the conditional and whose test part always returns true.

   Output values created in the test or body section of a clause are potentially available for use outside the conditional. However, any value used outside the conditional must be created in every clause, otherwise an undefined value would be accessed if a clause not defining the value were executed.

*Attributes

   Package StructuredActivities

Issue 9191 -add default value

   • isAssured : Boolean If true, the modeler asserts that at least one test will succeed. Default value is false.

Issue 8235 - remove phrase at end of sentence 9191 - add default value

   • isDeterminate: Boolean If true, the modeler asserts that at most one test will succeed. Default value is false.

*Associations

   Package StructuredActivities

   • clause : Clause [1..*] Set of clauses composing the conditional.

   Package CompleteStructuredActivities

Issue 8235 - add subsets constraint

   • result : OutputPin [0..*] A list of output pins that constitute the data flow outputs of the conditional. {Subsets Action::output}

*Constraints

Issue 8939 - add constraint

   [1] The result output pins have no incoming edges.

*Semantics

   No part of a conditional node is executed until all control-flow or data-flow predecessors of the conditional node have completed execution. When all such predecessors have completed execution and made tokens available to inputs of the conditional node, the conditional node captures the input tokens and begins execution.

   The test section of any clause without a predecessorClause is eligible for execution immediately. If a test section yields a false value, a control token is delivered to all of its successorClause s. Any test section with a predecessorClause is eligible for execution when it receives control tokens from each of its predecessor clauses.

   If a test section yields a true value, then the corresponding body section is executed provided another test section does not also yield a true value. If more than one test section yields a true value, exactly one body section will be executed, but it is indeterminate which one will be executed. When a body section is chosen for execution, the evaluation of all other test parts is terminated (just like an interrupting edge). If some of the test parts have external effects, terminating them may be another source of indeterminacy. Although test parts are permitted to produce side effects, avoiding side effects in tests will greatly reduce the chance of logical errors and race conditions in a model and in any code generated from it.

Issue 8493 - remove ‘concurrently’

   If no test section yields a true value, the execution of the conditional node terminates with no outputs. This may be a semantic error if a subsequent node requires an output from the conditional. It is safe if none of the clauses create outputs. If the isAssured attribute of the conditional node has a true value, the modeler asserts that at least one test section will yield a test value. If the isDeterminate attribute has a true value, the modeler asserts that at most one test section will yield a test value (the predecessor relationship may be used to enforce this assertion). Note that it is, in general, impossible for a computer system to verify these assertions, so they may provide useful information to a code generator, but if the assertions are incorrect, then incorrect code may be generated.

   When a body section is chosen for execution, all of its nodes without predecessor flows within the conditional receive control tokens and are enabled for execution. When execution of all nodes within the body section has completed, execution of the conditional node is complete and its successors are enabled.

   Within the body section, variables defined in the loop node or in some higher-level enclosing node may be accessed and updated with new values. Values that are used in a data flow manner must be created or updated in all clauses of the conditional, otherwise undefined values would be accessed.

*Notation

   No specific notation.

*Style Guidelines

   Mixing sequential and concurrent tests in one conditional may be confusing, although it is permitted.

   Conditional nodes are introduced to provide a structured way to represent decisions.

*Changes from previous UML

   Conditional nodes replace ConditionalAction from the UML 1.5 action model.