In UML sequence diagram a method can have only one return line (at least in Astah I'm unable to draw two return lines from one method), how can I model multiple returns in if-else blocks?
In below example, return line 'a' ends methodX(), how to draw return line 'b'?
String methodX(int i) {
if (i>0)
return 'a';
else
return 'b';
}
+------------+ +------------+
| Foo | | Bar |
+-----+------+ +------+-----+
| |
| methodX(i) |
+-+----------------------->+-+
| | | |
+-----+------------------------------------+
| alt | | | [i>0] | | |
+-----+ | | a | | |
| | |<- - - - - - - - - - - -+-+ |
| | | | |
| | | | |
+------------------------------------------+
| | | [else] | |
| | | | |
| | | b | |
| | |<- - - - - - - - - - - - | ?? |
| | | | |
| | | | |
+------------------------------------------+
| | |
+-+ |
+ +
The problem is with your tool, not with UML. Check out visual paradigm for UML. You can manually add activations at the start of each alt
fragment and at the end of the activation send the return message.