如何在序列图上表示 if condition1 else if contion2? [英] How to represent an if condition1 else if contion2 on a sequence diagram?
本文介绍了如何在序列图上表示 if condition1 else if contion2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道,如何在序列图中表示if cond1 else if cond2"语句?
I was wondering, how can one represent "if cond1 else if cond2" statement on a sequence diagram?
if (condition1) {
// Do something
} else if(condition2)
{
// Do something else if
}
我不确定是否有两个独立的Opt"子句
Im not sure if is it with two independent "Opt" clause
如果可能,请创建解决方案的图像表示.
If possible create an image representation of a solution.
推荐答案
在序列图中,您可以使用带有 alt
运算符的组合片段.这允许您显示替代行为:
In the sequence diagram, you can use a combined fragment with an alt
operator. This allows you to show alternative behaviors:
- 在图形上,备选方案位于由水平虚线分隔的平铺区域中.
- 您可以记录守卫中每个备选方案的精确条件(即
[condition]
).
示例:
补充阅读:
这篇关于如何在序列图上表示 if condition1 else if contion2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文