如何在 Activity 图中表示活动的重复

How to represent repetition of activities in Activity Diagram

我有一种情况,对于给定的数字,我必须重复几个 activity 与给定的数字一样多的次数。我如何使用 Activity 图在 UML 中表示这种情况?我以为我可以使用扩展区域,但我不知道如何使用。

最基本的方法是循环显示重复:使用 decision node and a flow looping back to a merge node

或者,您可以用扩展区域表示循环。使用关键字 <> 和扩展节点 link 区域内部及其外部。您可以在 section 6 of this article

中找到示例

但是,原则上使用扩展区域来处理输入中的集合:

If the value is iterative, the expansion executions must occur in an iterative sequence, with one completing before another can begin. The first expansion execution begins immediately when the ExpansionRegion starts executing, with subsequent executions starting when the previous execution is completed. If the input collections are ordered, then the expansion executions are sequenced in the order induced by the input collection. Otherwise, the order of the expansion executions is not defined.