UML状态图上的混乱

发布于 2025-02-13 20:18:26 字数 303 浏览 2 评论 0原文

我在网上提到了很多材料,我看到合并的用法几乎相同吗?一些站点说要使用钻石形状合并,有些人说使用交界处。我知道哪一个是正确的吗?以下图像是我读过的材料。

使用钻石形状合并 “使用钻石形状合并”

使用交界处合并 “使用innction”“合并”>

I have referred quite a lot of materials online, I saw the usage of merge and junction is almost the same? Some sites said to use the diamond shape as a merge, some said to use junction. Can I know which one is correct? The following images are the material I have read.

merge using diamond shape
merge using diamond shape

merge using junction
merge using junction

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猫瑾少女 2025-02-20 20:18:26

在状态机图中,有两个通常混淆的伪状态:连接状态(黑色填充圆圈)和选择状态(一个空心钻石)。不要将它们与活动图(初始节点,决策节点和合并节点)中的类似形状混淆。他们看起来只有一样。

现在,对于选择交界处的差异真实。然后,在检查选择状态之前,所有效果行为均在检查之前进行。这允许动态分支,具体取决于某些仅在启动过渡时评估的值。

A 交界处状态只是连接过渡。可以用尽可能多的过渡代替可能的路由。这样的过渡仅在路线上的所有全部后卫评估为true时就会发射。

这两种州都可以根据需要进行尽可能多的内外过渡。

In a state machine diagram there are two pseudo states that are often confused: The junction state (a black filled circle) and the choice state (a hollow diamond). Don't confuse them with similar shapes in an activity diagram (initial node, decision node and merge node). They only look the same.

Now for the difference between choice and junction states: A compound transition fires, when its triggering event occurs AND all guards before an eventual choice state evaluate to true. Then all the effect behaviors up to the choice state are executed before any of the guards of outgoing transitions are checked. This allows dynamic branching depending on some value that only gets evaluated when the transition has fired.

A junction state just connects transitions. It could be replaced with as many transitions as there are possible routings. Such a transition only fires if all guards on the route evaluate to true.

Both states can have as many in- and outgoing transitions as you like.

雨夜星沙 2025-02-20 20:18:26

作为一个旁注(不长时间评论),合并合并/决策的符号需要一些澄清。 UML 2.5 p。 387:

15.3.3.5合并节点

mergenode是一个控制节点,它在不同步的情况下汇集了多个流。 Mergenode应完全具有一个传出活动,但可能具有多个传入的活动。

下面(有点晦涩!):

15.3.3.6决策节点

决策节点是在外向流之间选择的控制节点。决策节点至少应具有至少两个传入的活动,并且至少应有一个外向活动。如果它具有两个传入的边缘,则应将一个识别为决策界流,另一个被称为主要传入边缘。如果决策节点只有一个传入边缘,则是主要的传入边缘。

请注意,这是关于活动而不是国家的!

@AxelsCheithauer 指出,该图渲染可能会偏差。 UML 2.5州的P. 390

可以通过使用相同的节点符号将Mergenode和DeciestNode的功能组合在一起,如图15.34所示。最多可以将传入的流量作为决策流提供注释。该符号将图表映射到包含图表中所有传入边缘的Mergenode的模型,以及一个向外的边缘到具有图中显示的所有传出边缘的一个外向边缘。

“在此处输入图像描述”

As a side note (too long for a comment) the notation for the combined merge/decision needs some clarification. UML 2.5 states on p. 387:

15.3.3.5 Merge Nodes

A MergeNode is a control node that brings together multiple flows without synchronization. A MergeNode shall have exactly one outgoing ActivityEdge but may have multiple incoming ActivityEdges.

and below (a bit more obscure!):

15.3.3.6 Decision Nodes

A DecisionNode is a ControlNode that chooses between outgoing flows. A DecisionNode shall have at least one and at most two incoming ActivityEdges, and at least one outgoing ActivityEdge. If it has two incoming edges, then one shall be identified as the decisionInputFlow, the other being called the primary incoming edge. If the DecisionNode has only one incoming edge, then it is the primary incoming edge.

Note that this is about activities and not states!

As @AxelScheithauer noted, the diagram rendering may deviate. P. 390 of UML 2.5 states

The functionality of a MergeNode and a DecisionNode can be combined by using the same node symbol, as shown in Figure 15.34. At most one of the incoming flows may be annotated as a decisionInputFlow. This notation maps to a model containing a MergeNode with all the incoming edges shown in the diagram and one outgoing edge to a DecisionNode that has all the outgoing edges shown in the diagram.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文