How to use expansion regions for loops in an activity diagram?

Jax*_*ler 5 uml modeling enterprise-architect activity-diagram

I am having problems designing a proper UML activity diagram.

I've seen similar questions and possible answers: How to present a loop in activity diagram?

Even with these answers I am having doubts and my own answer doesn't correspond with the UML definitions.

Summarization of the problem: Loop over folders and files in each folder, act upon each folder depending on its name and upon each file depending on its name. The main problem I am having is if I am using the expansion region correctly.

Many sources tell that an expansion region must have an input collection and an output collection. But I don't necessarily have an output collection.

Is it automatically assumed that the Region will iterate over all items until no items are left before it goes into ActivityFinal?

Here is a Enterprise Architect screenshot of what I've done: 在此处输入图片说明

Axe*_*uer 4

首先,您的扩展节点与控制流连接,或者您的操作与对象流连接,这两者都是不可能的(太糟糕了,EA 不强制执行此规则)。这意味着您需要在初始节点之后有一个操作,为您提供一个集合。您还可以在活动图中使用活动。与普遍看法(以及 EA)相反,这是不允许的。您应该使用操作(可能是 CallBehaviorActions 调用活动,但这取决于您)。

我不知道你到底想模拟什么。然而,这是我对扩展区域的有效使用的建议: 在此输入图像描述 第一个扩展节点为目录中的每个文件夹创建一个对象令牌。第二个扩展节点为文件夹中的每个文件创建一个对象令牌。如果需要访问文件夹名称,只需将对象流绘制到区域中即可。然后,这将为内部扩展区域的每次执行提供一个单独的文件夹令牌。

如果不需要,则无需对输出扩展节点进行建模。只需使用 Flow Final Node 结束每次执行即可。最后一次执行完成后,Region 将为传出控制流生成一个令牌。