本文介绍了分叉/联接节点对令牌的行为与活动图的其他节点之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在图中,您只能通过查看传入和传出的 InformationFlow 来区分两者。第一个具有多个传入和一个传出,而第二个具有相反的关系。 MergeNode 接受任何传入令牌并将其直接转发到其单个传出 InformationFlow 。因此,与 Action s不同,它不会等待所有令牌。相反, DecisionNode 仅接受单个令牌,并使其仅传递给其传出的 InformationFlow 之一。建模者有责任以只有一个人评估为正确的方式来设置防护。如果有更多(甚至没有人看守)的 InformationFlow ,令牌将采用任何任意的免费路线。



Fork Join 也是看起来相同的两个不同元素:(



您还可以通过传入/传出的 InformationFlow 的数量来区分它们。 叉子有一个进出多个,而 Join 反之亦然。一旦令牌到达其单个传入的<$ c, Fork 就会发送与传出的 InformationFlow s一样多的令牌。 $ c> InformationFlow 。 Join 将(像 Action s一样)等待令牌到达其所有传入的 InformationFlow s。只有这样,它才会在其单个传出的 InformationFlow 处出现一个令牌。



因此,在 Merge -和 DecisionNode 进行控制的同时,单个令牌的流(执行路径) Fork Join 用于启动和同步并行执行路径。


As Thomas Kilian described here, normal behavior of nodes of Activity diagrams with tokens is:

But also he added:

I know that behavior of "merge" node differs because it becomes immediately active by receiving first token and accepts one among several alternate flows. But what is the difference between behavior of fork/join nodes with tokens with normal behavior?

解决方案

Merge- and DecisionNodes look the same, but are different elements: .

In a diagram you can only distinguish both by looking at the incoming and outgoing InformationFlows. The first has multiple incoming and one outgoing while the second has the opposite relation. A MergeNode accepts any incoming token and forwards it directly to its single outgoing InformationFlow. So unlike Actions it will not wait for all tokens. The DecisionNode in contrast accepts only a single token and lets it pass to only one of its outgoing InformationFlows. It is the modeler's responsibility to set guards in a way that only one evaluates to true. If there are more (or even unguarded) InformationFlows the token will take any arbitrary free route.

Fork and Join are also two different elements which look the same: (or vertically).

You can also distinguish them by the number of in-/outgoing InformationFlows. Fork has one in and multiple out and Join vice versa. A Fork will send as many tokens as it has outgoing InformationFlows once a token arrives at its single incoming InformationFlow. The Join will (like Actions) wait for tokens arrive at all of its incoming InformationFlows. Only then it will emerge a single token at its single outgoing InformationFlow.

So while Merge- and DecisionNodes control the flow of a single token (execution path) Fork and Join are used to start and synchronize parallel execution paths.

这篇关于分叉/联接节点对令牌的行为与活动图的其他节点之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 16:27