使用区域循环的UML活动图 [英] Loop in UML activity diagram using a region

查看:4384
本文介绍了使用区域循环的UML活动图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在建模的UML活动图的循环。它能够很好地处理简单的条件节点(图1),但我期待一个更EX pressive方式为强调循环语义。 于是,我来到了区域或可中断的区域,这显示href="http://www.pst.ifi.lmu.de/~stoerrle/V/AD-4b-ExpansionNJC.pdf">这里和<一href="http://www.sparxsystems.com/enterprise_architect_user_guide/modeling_languages/loop_and_conditional_nodes2.html">there,但我不能找到许多真正令人满意的例子。

I am modeling a loop in an UML activity diagram. It works well with simple condition nodes (diagram 1), but I am looking for a more expressive way to emphasise the loop semantic. So I came to "regions" or "interruptible regions" which are shown here and there, but I couldn't find many really satisfying examples.

我的例子是一个函数,处理一个给定的列表中的消息。循环中止,一旦第一个有效的消息被找到,则该消息被处理的函数返回true。否则,它将返回false(请在意识或无义没有意见,这只是为了样品的)。

My example is a function which processes messages of a given list. The loop aborts as soon as the first valid message is found, then the message is processed and the function returns true. Otherwise, it returns false (please no comments on sense or nonsense, it's only for the sake of a sample).

图1:使用好老活动图条件节点。这是比较容易跟着​​箭头的控制流程,无可否认的,但没有循环,也仅仅是一个如果。

Diagram 1: uses a good old activity diagram conditional node. It is easier to follow the control flow along the arrows, admittedly, but there is no "The LOOP", there is just an "if".

图2:

  • 是(正)退出条件正确,使用中断边缘?诚然,这可能是随着迭代循环的[测试]节的一部分。
  • BTW:怎么是pssed在UML for循环最好的EX $ P $的迭代字符
  • 是循环体正确内部的活动最终节点(即当条件的消息是否有效?收益率不)?它莫名其妙地觉得这是错在这里使用的最终节点,但是还能怎么我EX preSS一个循环的控制流的 的?
  • is the (positive) exit condition correct, using an interrupting edge? True, it could be part of the [test] section of the loop along with the iterator.
  • BTW: how is the iterating character of a for-loop best expressed in UML?
  • Is the activity final node inside the loop body correct (i.e. when the conditional "message valid?" yields "no")? It somehow feels wrong to use a final node here, but how else can I express the control flow of one loop?

这两个图表的功能应该是等价的:

The functionality of both diagrams should be equivalent:

编辑:从斯蒂芬实现建议的另一个图:

Another diagram which implements the suggestions from Steph:

  • 循环体中的初始和最后一个节点
  • 在进一步处理现在的循环体中。嗯...好了,但也有可能是其他循环,我宁愿把它外面。然后,我可能改变设计反正...
  • 在下一个消息,也可以看作是 iterator对象的本身,而不是的动作的从原来的图(提供)下一条消息。
  • 在两个物体的流动箭头可能是有点大材小用,但我认为他们是正确的。
  • Initial and final node inside the loop body
  • "further processing" is now inside the loop body. Well... OK here but there might be other loops where I would rather have it outside. Then I might change the design anyway...
  • The "next message" can also be seen as the iterator object itself instead of the action "(provide the) next message" from the original diagram.
  • The two object flow arrows might be a bit overkill, but I think they are correct.

推荐答案

在UML中,活动最后的节点重新presents一个完成,因此,你使用它它是在一个环区正确的,这是正常完成你的循环的内容(其中轮流进入下一迭代)。作为一个方面说明,我劝你也可以使用一个初始节点的循环的开始。

In UML, the activity final node represents a completion, so it is correct in a loop region as you use it, it is the normal completion of the content of your loop (which in turns leads to the next iteration). As a side note, I advise you to also use an initial node for the beginning of your loop.

和也有流最终节点,即重新presents代替完成一个出口,。因此,你可以用它来重新代替使用中断边缘present的破发的声明。在这种情况下,你必须将进一步消息处理节点,融入是分支,只是这种流动最终节点之前。

And there is also the flow final node, that represents an exit, instead of a completion. Thus, you can use it to represent the "break" statement, instead of the interrupting edge you use. In this case you have to integrate the "further message processing node", in the "yes" branch, just before this flow final node.

该中断边缘,而对中断从当前处理外面传来。该地区是中断的,还有一些事件(通常注意到,接收节点)可能会完全中断它无论是区域内容的进度。这里它不是这种情况。

The interrupting edge is rather for interruptions coming from outside the current processing. The region is interruptible, and some events (usually noted with receive nodes) may completely interrupt it no matter the progress of the region content. Here it is not the case.

关于迭代的性格,没有什么很直观,很遗憾。我倾向于在该地区的顶部使用对象节点,只是旁边的初始节点。

Concerning the iterating character, there is nothing very visual, unfortunately. I tend to use an object node on top of the region, just beside the initial node.

这篇关于使用区域循环的UML活动图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆