在上一个问题中,我试图实现对类进行排序的想法。尽管我提出的示例不合适。
所以这是我想通过UML类图归因的情况:
在ODT文档中,我有一个叫做的东西figure
。该图由两个原子元素组成:image
和title
(图像的)。该标准允许我将放置title
在上方image
或下方。尽管在我的应用程序中,title
它将始终image
像下面这样:
So in my case I want to submit the (more specific) information that the title must be beneath the image (although the standard does not obligate so). Thus I came up to the idea of making order in my class diagram (this is first, then this, then this, etc...). Because in my case that matters.
Here is my despaired attempt:
Is there any approach to present that information through a UML Class Diagram?
In the UML meta-model, there are meta-elements called Class
and Property
. An instance of a Class
meta-element (e.g., called Figure
) may own instances of a Property
meta-element. Each instance of a Property
meta-element has a type (e.g., Image
and Figure
). Both of the instances of the Property
meta-element in your model are unnamed, which, unfortunately, makes it difficult to refer to them. Nonetheless, all of the instances of the Property
meta-element that an instance of the Class
meta-element owns are ordered. When you create a property in a UML tool, you generally add it to the end of an ordered list.
In your diagram there are two unnamed properties that are already ordered (implicitly, based on which you created first in the tool). This order can be seen and changed in a UML compliant tool. Here is an example UML model:
I strongly recommend you name all your properties, as I have done in my example model. For example, I named them title
and image
, starting with a lower-case letter. Among other benefits, that way you can see which is which more easily when you reorder them.
Here is a specification window in a professional tool called MagicDraw, where you can drag properties into the order you like:
You could change the order to say that the image comes before the title.
PS,在分析模型中,如果此排序是在问题领域中很重要的规则,则实际上我将显示一个显式的关联,Image
并Title
在关联末端具有类似comes before
和的名称comes after
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句