如何在UML对象图中显示多重性 [英] How to show multiplicities in UML object diagrams

查看:298
本文介绍了如何在UML对象图中显示多重性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法在UML中创建对象数组?

I wonder if there is way to create an array of objects in UML?

以下是我使用Modelio作为建模环境的尝试,但是您可以看到存在不同的对象(即instance [0],instance 1],instance [2],instance [3])

the following is my try using Modelio as a modeling environment but as you can see there is different objects(i.e. instance[0],instance 1],instance[2],instance[3])

推荐答案

如您所知,有两种方法可以在类图中显示UML属性:属性文本和关联符号.

As you know there are two ways to show UML attributes in class diagrams: attribute text and association notation.

考虑一个公司和员工的例子.两个有效的类图是:

Consider an example of a company and employees. Two valid class diagrams are:

现在让我们尝试绘制相应的对象图:

Now let's try to draw the corresponding object diagrams:

如果像年龄这样的全职员工的详细信息很重要,则别无选择,只能将它们显示为单独的对象:

If the details of the fulltime_employees like age are important, there is no other way but to show them as separate objects:

如果细节不重要,我们可以使用属性文本表示法:

If details are not important, we could go with attribute text notation:

当对象数量更多时显示它的另一种方法(这里是5):(这也是在对象图中显示多重性的一般方法)

Another way of showing it when number of objects is more (let's say 5 here): (This is also the general way to show multiplicities in object diagrams)

希望有帮助.

这篇关于如何在UML对象图中显示多重性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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