zakariag
zakariag

Reputation: 335

How to show "if" condition without else in sequence diagram

I want to know how do you design an if condition that doesn't have an "else" in your sequence diagrams? I don't know if I have to do it with an alternative because I will have just one case or nothing, so I will not have any alternatives. Thank you for your answers.

Upvotes: 7

Views: 13628

Answers (3)

Peter Uhnak
Peter Uhnak

Reputation: 10217

There is no need to include multiple operands.

The specs (17.6.2) just require that you have at least one operand per fragment (there are no additional constraints for alt kind).

enter image description here

So you can do just that

enter image description here

Also as Thomas noted, you can use opt, which is equivalent (emphasis mine):

An option is semantically equivalent to an alternative CombinedFragment where there is one operand with non-empty content and the second operand is empty.

Upvotes: 8

qwerty_so
qwerty_so

Reputation: 36313

Use an opt fragment like this

enter image description here

The condition is shown in square brackets. I think, an alt would also do with just one case.

Upvotes: 5

zakariag
zakariag

Reputation: 335

I just found this document http://www.omg.org/news/meetings/workshops/MDA-SOA-WS_Manual/00-T4_Matthews.pdf in page 54 I found Opt. I searched in the Internet and it seems that it's exactly what I was asking for.

Upvotes: 2

Related Questions