views:

623

answers:

1

I was wondering if there is a way to depict that, on an activity that has a decision; one of the branches completely terminates with the activity. This would be similar to a subroutine just returning control to the invoker when a condition is met.

sub activity() {
   ...
   ...
   if ( condition ) {
      ...
   } else {
      return;//This branch finishes the activity
   }
   ...
}

Thanks,

Carlos

+1  A: 

The following code would look like the diagram below it.

if (D1)
{
    if (D2)
    {
        return;
    }
}
else
{
    return;
}

     /\         /\
o___/D1\__T____/D2\__T_______0
    \  /       \  /          |
     \/         \/           |
     |____F__________________|

Note, that in this case, D2:False goes nowhere, in both the diagram and the code. I was just trying to illustrate the points that lead to the end of the activity. (note: the '0' is the end of the activity and the 'o' is the start)

SnOrfus
Your approach looks reasonable. I can see you are not using 'merge nodes' (diamonds to demarcate the end of the conditional behavior started at the decision node.) The reason I got into the problem of depicting the 'aborting branch' are those 'merge nodes.' Not that I want to be taken as the picky UML boy, I was just wondering if there's a reasonable way to show such a construct. Thank you anyway!
Ytsejammer