EA&UML日拱一卒-活动图::Types and Multiplicity

网友投稿 953 2022-10-13

EA&UML日拱一卒-活动图::Types and Multiplicity

EA&UML日拱一卒-活动图::Types and Multiplicity

本文是UML2.5规范英文版中关于类型和多重度的内容,作者将其翻译成中文,供参考。

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(抽象语法)

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

参考资料:

《OMG Unified Modeling Language TM (OMG UML) Version 2.5》

URL:http://omg.org/spec/UML/2.5

以上就是今天的文章,欢迎推荐给您的朋友!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ColaPHP- PHP框架
下一篇:开发者版小程序(小程序 开发版)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~