This clause defines the mapping of Alf statements to UML. The abstract syntax for Alf statements is described in Clause 13.2.
18.1General
Every statement is mapped to a single activity node (which may be a structured activity node with nested structure). The specific mapping for each kind of statement is described in the following subclauses.
If the static analysis of assignment indicates that a name with an assigned source has a different assigned source after a statement than before the statement, and the statement maps to a structured activity node (but not a conditional node or a loop node), then an input pin corresponding to that name is added to the structured activity node. This input pin is the target of an incoming object flow from the assigned source of the name before the statement. The input pin is also connected by an outgoing object flow to a fork node contained in the structured activity node. This fork node acts as the assigned source for the name within the mapping of the statement.
A block maps to the union of the nodes mapped from the statements in it. In addition, unless the block is in a block statement annotated as being parallel (see Subclause 18.3), the node mapped from each statement other than the last has a control flow targeted to the node mapped from the next statement.
A statement for which @isolated is allowed is always mapped to structured activity node, and annotating it @isolated results in the isIsolated property on this node being true. (Other annotations are discussed with the description of the statements to which they apply.)
An in-line statement maps to an opaque action with a body given by the code text within the statement with a corresponding language string given by the language name in the statement. (The language string is given by the actual name and so does not include the single quotes that appear in the representation of an unrestricted name.)
Depending on the mechanism used by a specific implementation, the opaque action may also have input and/or output pins with connected object flows for providing data to and from the code executed by the opaque action. However, the details of such mapping are not defined by the Alf standard.
NOTE. The fUML subset does not include opaque actions, so an activity mapped from Alf including an in-line statement will not be executable as fUML. The execution behavior of such an activity is implementation specific.
18.3Block Statements
A block statement maps to a structured activity node containing all the activity nodes and edges mapped from its block. If the block statement is not parallel, then the nodes mapped from the statements of the block have control flows between them enforcing their sequential execution. If the block statement is parallel, then there are no such control flows.
18.4Empty Statements
An empty statement maps to an empty structured activity node.
NOTE.Mapping an empty statement to something preserves the rule that every statement maps to a single activity node and allows for the general rule for the mapping of control flow within a statement sequence.
18.5Local Name Definition Statements
A local name declaration statement is mapped as if it was an expression statement (see Subclause 18.6) with an assignment expression (see Subclause 17.24) having the local name as its left-hand side and the expression as its right-hand side.
18.6Expression Statements
An expression statement maps to a structured activity node containing the activity nodes and edges mapped from its expression (see Subclause 8).
18.7if Statements
Clauses
An if statement maps to a conditional node. Each if clause maps to a clause of the conditional node. For a final if clause, the test part of the clause is a single value specification action for a Boolean literal with value “true”.
Each clause specified in a concurrent clause set has as predecessors all clauses specified by the immediately preceding concurrent clause set (if any) in the sequential clause set for the conditional node. A final clause has as its predecessor all clauses specified by the immediately preceding concurrent clause set.
The isAssured and/or isDetermined properties of the conditional node are set according to whether the if statement is assured or determined.
Output Pins
The conditional node has a result output pin corresponding to each local name that is assigned in any of the if clauses. Therefore, each clause of the conditional node also must have a body output pin from within the clause identified for each result pin of the conditional node. If a name is assigned within a clause and the assigned source for that name within the clause is a pin on an action within the body of the clause, then that pin is used as the clause body output pin corresponding to that local name. Otherwise, a structured activity node is added to the mapping of the clause as follows.
The structured activity node has one input pin and one output pin, with an object flow from the input pin to the output pin contained within the structured activity node.
There is an object flow from the assigned source for the name after the clause (which may be from inside or outside the clause) to the input pin of the structured activity node.
The output pin of the structured activity node is then used as the clause body output pin corresponding to the name.
18.8switch Statements
Clauses
A switch statement maps to a structured activity node that contains a conditional node and the mapping for the switch expression. The switch clauses map to concurrent clauses of the conditional node. Each clause tests whether the result of the switch expression equals the result of one of the case expressions.
A switch default clause is mapped to a conditional node clause with a condition of true and with all other clauses as predecessor clauses.
The isAssured and/or isDetermined properties of the conditional node are set according to whether the switch statement is assured or determined..
Output Pins
The result and clause body output pins of the conditional node are mapped as for an if statement (see Subclause 18.7).