简体   繁体   English

如何在序列图中多次调用完整的内部流程

[英]How to call complete internal flows multiple times in Sequence Diagrams

Main Idea: To convert an activity diagram into a sequence diagram.主要思想:将活动图转换为序列图。

Problem: I want that if "Action 2" fails then, in that case all the flows get triggered again from "Action 1".问题:我希望如果“操作 2”失败,那么在这种情况下,所有流程都会从“操作 1”再次触发。

(ie Action 1 --> Action 2 --> then the verification again. and this should happen until Action 2 is Successful) (即行动 1 --> 行动 2 --> 然后再次验证。这应该发生直到行动 2 成功)

Basically, the flow works like a GOTO function and then from there triggers all the steps again.基本上,流程就像 GOTO 函数一样工作,然后从那里再次触发所有步骤。

I have tried to use a ref block but again it seems that it might be ambiguous and someone might read it only as the "execution of Action 1" and not the steps after it.我曾尝试使用 ref 块,但似乎它可能是模棱两可的,有人可能只将其视为“执行动作 1”而不是其后的步骤。

Therefore I wanted some hints to make this sort of scenario clear.因此,我想要一些提示来明确这种情况。 Any suggestions would be appreciated.任何建议,将不胜感激。

Attaching the image for better clarity of the problem.附上图像以更好地说明问题。

在此处输入图像描述

The activity and sequence diagrams are not supposed to be equivalent.活动图和序列图不应该是等价的。 Both set a different focus (flow vs interactions) and as a consequence you might have to do the mapping by identifying higher-level constructs.两者都设置了不同的焦点(流程与交互),因此您可能必须通过识别更高级别的结构来进行映射。

Here you have clearly a loop:在这里,您显然有一个循环:

在此处输入图像描述

You could reformulate in pseudocode as: REPEAT action 1 and action 2 UNTIL action 2 passes , which is a loop that has the test in the end.您可以用伪代码重新编写为: REPEAT action 1 and action 2 UNTIL action 2 passes ,这是一个最终进行测试的循环。 You could further rewrite this loop into: Last did not passed; WHILE last did not pass, DO action 1 and action 2您可以进一步将此循环重写为: Last did not passed; WHILE last did not pass, DO action 1 and action 2 Last did not passed; WHILE last did not pass, DO action 1 and action 2 , or WHILE true DO action 1 and action 2 and BREAk if it succeeds . Last did not passed; WHILE last did not pass, DO action 1 and action 2 ,或者WHILE true DO action 1 and action 2 and BREAk if it succeeds

Now you can use a loop fragment to achieve this behavior in a sequence diagram.现在您可以使用循环片段在序列图中实现此行为。 This fragment would enclose action1, action 2, and the test for success, and after the loop, would come the interaction for the success case.该片段将包含动作 1、动作 2 和成功测试,在循环之后,将出现成功案例的交互。 The nesting makes it very explicit what gets repeated and what not.嵌套使得重复什么和不重复什么变得非常明确。 For example, some variant of:例如,一些变体:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM