Question

Hy

How can i describe this in a UML activity-diagram?

Latest (earliest_start_date, Earliest (latest_start_date, start_date))

that means: choose the earliest from latest_start_date and start_date and use earliest_start_date if its later then the result of the previous decision. I tried it with the diamonds but i think i need a bit more.

I hope you can help me

Thanks.

Was it helpful?

Solution

The most complicate part is that decision nodes pass along to the chosen edge the token (i.e. "value") that they received, then you need to make explicit that the value has changed depending on which branch was executed. If you are modelling start_date as an object flow (where the value of start_date flows through the diagram) and earliest_start_date and latest_start_date are in-scope variables or constants, you may represent the operation as:

enter image description here

(Note that I assumed that earliest<latest in order to simplify the branches) The upper "diamond" is a decision node. One of the three branches is selected, depending on the branch (i.e. condition) that is given between brackets for each edge. The lower diamond is a merge node (where the alternative execution paths meet). In the notation of the guards I assumed that the < operator is applicable to the type of start_date.

Another approach is writing a transformation that represents the operation. In this case the input of ActionState2 will be the result of the transformation, where start_date is the output of ActionState1.

enter image description here

A third approach is writing the operation as a postcondition of the action where such calculation is performed (i.e. a Constraint with stereotype «postcondition»attached to the action).

If Latest and Earliest are defined as functions in your model, the postcondition is:

result = Latest (earliest_start_date, 
                  Earliest (latest_start_date, start_date))

enter image description here

If the type of start_date defines min and max, the postcondition may be written as:

result = min(Set{latest_start_date, 
             max(Set{earliest_start_date,start_date})});

(i.e. the minimum value of a set composed by a) the latest_start_date, b) the maximum value of set composed by the earliest_start_date and the start_date.

If the < operator is defined for the type of start_date, the postcondition is:

result = if start_date<earliest_start_date 
            then earliest_start_date 
            else 
              if start_data>latest_start_date 
                then latest_start_date 
                else start_date
              endif
          endif

You may also represent it as a ConditionalNode (a structured activity node that chooses one among some number of alternatives), but there is no standard notation defined for ConditionalNodes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top