EA画UML图中Types and Multiplicity有什么用

发布时间:2021-12-20 14:40:23 作者:小新
来源:亿速云 阅读:140

这篇文章主要介绍了EA画UML图中Types and Multiplicity有什么用,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

7.5.1 Summary(概要)


Types and multiplicity are used in the declaration of Elements that contain values, in order to constrain the kind and number of values that may be contained.

类型和多重度用于包含值的元素的声明中,目的是限制可以包含的值的数量和类型。

7.5.2 Abstract Syntax(抽象语法)

EA画UML图中Types and Multiplicity有什么用

Figure 7.10 Abstract syntax of types and multiplicity elements

7.5.3 Semantics(语义)

7.5.3.1 Types and Typed Elements(类型和类型化元素)

A Type specifies a set of allowed values known as the instances of the Type. Depending on the kind of Type, instances of the Type may be created or destroyed over time. However, the rules for what constitutes an instance of the Type remain fixed by the definition of that Type. All Types in UML are Classifiers (see Clause 9).

类型定义了被称为类型的实例的允许值的集合。根据类型的种类,类型的实例可以被创建或者一段时间以后被销毁。然而,决定由什么来构成类型的实例的规则仍然会被类型的定义修正。UML中的所有的类型都是类目。

A TypedElement is a NamedElement that, in some way, represents particular values. Depending on the kind of TypedElement, the actual values that it represents may change over time. Examples of kinds of TypedElement include
ValueSpecification, which directly specifies a collection of values (see Clause 8), and StructuralFeature, which represents values held as part of the structure of the instances of the Classifier that owns it (see sub clause 9.4).

一个类型化元素在某种情况下是一个命名元素,代表特殊值。根据类型化元素的种类,它所表现的实际值会随着时间而改变。类型化元素的例子包括值定义,它直接定义值的聚集,还有结构化功能,可以表现一些值,这些值作为拥有它的类目的实例的结构的一部分来保持。

If a TypedElement has an associated Type, then any value represented by the TypedElement (at any point in time) shall be an instance of the given Type. A TypeElement with no associated Type may represent any value.

如果一个类型化元素有一个关联类型,那么被这个类型化元素表达的任何值都给应该是给定类型的实例。没有关联类型的类型化元素可能表现任何值。

7.5.3.2 Multiplicities(多重度)

A MultiplicityElement is an Element that may be instantiated in some way to represent a collection of values.Depending on the kind of MultiplicityElement, the values in the collection may change over time. Examples of kinds of
MultiplicityElement include StructuralFeature, which has values in the context of an instance of the Classifier that owns it (see sub clause 9.4) and Variable, which has values in the context of the execution of an Activity (see sub clause 15.2).


多重元素可以被以某种方式实例化,以表现值的聚合。根据多重元素的种类,聚合中的值会随着时间发生改变。多重元素的例子有结构化功能,它保持拥有它的类目的实例的上下文中的值;还有变量,它保持一个活动的执行的上下文中的值。


The cardinality of a collection is the number of values contained in that collection. The multiplicity of a MultiplicityElement specifies valid cardinalities of the collection it represents. The multiplicity is a constraint on the cardinality, which shall not be less than the lower bound and not greater than the upper bound specified for the multiplicity (unless the multiplicity is unlimited, in which case there is no constraint on the upper bound).


聚合的基数是在聚合中包含的值的数量。多重元素的多重度定义了它所表现的聚合的有效基数。多重度是基数的约束,基数不应该少于多重度的下限也不应该超过多重度的上限(除非多重度是无限,这种情况的含义是没有上限)

The lower and upper bounds for the multiplicity of a MultiplicityElement are specified by ValueSpecifications (see Clause 8), which must evaluate to an Integer value for the lowerBound and an UnlimitedNatural value for the upperBound (see Clause 21 on Primitive Types). A MultiplicityElement is unlimited if its upperBound has the UnlimitedNatural value of unlimited (“*”). A MultiplicityElement is multivalued if it has an upperBound greater than 1 (including unbounded). A MultiplicityElement that is not multivalued can represent at most a single value.


多重元素的多重度的上下限是由值定义(ValueSpecificaiton)来定义的。它运算后可以得到整数类型的下限值和一个无限自然数类型的上限值。如果上限被指定为无限自然数类型的无限(“*”),那么多重元素就是无限的。如果多重元素的上限大于1(包含上限),那么它就是多值的,非多值的多重元素只能表现至多一个单值。


A MultiplicityElement can define a multiplicity both of whose bounds are zero. This restricts the allowed cardinality to be 0; that is, it requires that an instantiation of this element contain no values. This is useful in the context of Generalizations (see sub clause 9.2) to constrain the cardinalities of a more general Classifier. It applies to (but is not limited to) redefining properties existing in more general Classifiers.

多重元素可以将多重度的界限值都定义为0。这要求可能的基数为0。也就是说,请求的是一个该元素的不包含值的实例。这种做法在泛化场景中可以用于约束更加一般(上级)的类目的基数。它申请(但不是限制)在更加一般的类目中存在重新定义的属性。


If the MultiplicityElement is specified as ordered (i.e., isOrdered is true), then the collection of values in an instantiation of this Element is ordered. This ordering implies that there is a mapping from positive integers to the elements of the collection of values. If a MultiplicityElement is not multivalued, then the value for isOrdered has no semantic effect.

如果多重元素被定义为有序的(即isOrdered为真),则以为该元素中的值的聚合就是有序的。这里的顺序意味着存在一个从正整数到值聚合元素的映射。如果多重元素不是多值的,那么isOrdered的值没有语义上的效果。

If the MultiplicityElement is specified as unordered (i.e., isOrdered is false), then no assumptions can be made about the order of the values in an instantiation of this Element.


如果多重元素被定义为无序的(即isOrdered为假),那么就不能对包含在元素实例中值的顺序进行任何的假设。


If the MultiplicityElement is specified as unique (i.e., isUnique is true), then the collection of values in an instantiation of this Element must be unique. That is, no two values in the collection may be equal, where equality of objects (instances of Classes) is based on object identity while equality of data values (instances of DataTypes) and Signal instances is based on value (see also sub clauses 10.2, 10.3, and 11.4 on DataTypes, Signals and Classes, respectively ). If a MultiplicityElement is not multivalued, then the value for isUnique has no semantic effect.

如果多重元素被指定了唯一性(即isUnique为真),那么元素实例中值的聚合必须是满足唯一性的。就是说在聚合中没有两个值相等,这里的相等对于对象来说是根据对象同一性来判断的,而对于数据值和信号实例就是根据数值来判断的。如果多重元素不是多值的,那么isUnique属性的值不具有语义上的效果。

Taken together, the isOrdered and isUnique properties can be used to specify that the collection of values in an instantiation of a MultiplicityElement is of one of four types. Table 7.1 shows the traditional names given to each of these collection types.

总的来说,isOrdered和isUnique属性可以用来决定多重元素的实例的值聚合属于四种类型中的哪一种。表格7.1表示了这四种聚合类型传统的名称。

Table 7.1 Collection types for MultiplicityElements

EA画UML图中Types and Multiplicity有什么用

感谢你能够认真阅读完这篇文章,希望小编分享的“EA画UML图中Types and Multiplicity有什么用”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

推荐阅读:
  1. 如何采用EA画UML活动图
  2. UML建模工具中EA和Rose有什么区别

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

ea uml

上一篇:Kubernetes的PVC是什么

下一篇:EA画UML图中如何为类添加操作和方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》