Difference between behavior of fork/join nodes toward tokens with other nodes of Activity diagrams

穿精又带淫゛_ 提交于 2019-12-20 04:25:09

问题


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

A node becomes active when at all of its incoming InformationFlow connectors a token has arrived. When the node finalizes it sends single tokens along all its outgoing InformationFlow connectors.

But also he added:

There are special nodes like fork and merge which behave a bit different

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?


回答1:


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.



来源:https://stackoverflow.com/questions/52181253/difference-between-behavior-of-fork-join-nodes-toward-tokens-with-other-nodes-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!