您好,登录后才能下订单哦!
这篇文章主要介绍EA画UML活动图中Structural Feature Actions的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
16.8.1 Summary(概要)
StructuralFeatureActions support the reading and writing of StructuralFeatures.
结构特征动作支持读写结构特征。
16.8.2 Abstract Syntax(抽象语法)
16.8.3 Semantics(语义)
16.8.3.1 Structural Feature Actions(结构特征动作)
A StructuralFeatureAction is given a statically-specified StructuralFeature of a Classifier, and an object on which to act on its object InputPin. This object is either an instance (direct or indirect) of the Classifier that owns the StructuralFeature or, if the StructuralFeature is an ownedEnd of a binary Association, an instance of the type of the opposite end of the Association. If the StructuralFeature is an Association end, then a StructuralFeatureAction has the same semantics as a LinkAction on an Association that has the StructuralFeature as an end (see specializations of StructuralFeatureAction). The semantics are undefined if the StructuralFeature is not visible from the context Classifier of the StructuralFeatureAction or from the containing Behavior, if there is no context Classifier (see sub clause 16.2.3 about context objects), or if the StructuralFeature has isStatic=true.
结构特征动作有两个输入:静态定义的类目的结构特征和通过object输入引脚指定的操作对象。这个对象可以是拥有结构特征的类目的一个实例(直接或间接),如果结构特征是是一个二元关联的拥有者端,一个某种类型的实例位于关联的反对端。如果结构特征是一个关联端,对于一端为结构特征的关联来说,结构特征动作和链接动作具有相同的语义(参考结构特征的特化)。下列情况下语义未定义:当结构特征在结构特征的上下文类目中或者在包含它的动作中不可见时;如果不存在上下文类目或者结构特征的isStatic属性为true时。
The StructuralFeatures and Associations in which an object participates may change over time due to dynamic classification (see ReclassifyObjectAction in sub clause 16.4). However, the type of the object InputPin of a StructuralFeatureAction is a single Classifier, and the semantics are defined only when the object passed to the Action is classified by that Classifier (directly or indirectly) at the time the Action accepts it and while the Action is executing.The StructuralFeature is referenced from a StructuralFeatureAction as a model Element, so it is uniquely identified,even if there are other StructuralFeatures of the same name on other Classifiers.
因为动态分类,结构特征和一个对象参与的关联有可能随着时间改变(参见16.4 小节 ReclassfityObjectAction)。然而结构特征动作的object输入引脚的类型是一个单独的类目,而且它的语义只在动作执行时接受的对象是被这个类目分类的情况下才有意义。
A ReadStructuralFeatureAction reads the values of a StructuralFeature and places these values on its result OutputPin.The other kinds of StructuralFeatureActions, WriteStructuralFeatureActions (including AddStructuralFeatureValueActions and RemoveStructuralFeatureValueActions) and ClearStructuralFeatureActions modify the values of a StructuralFeature. These Actions may optionally have a result OutputPin. If a result OutputPin is provided, then the input object, as modified, is placed on this OutputPin. If the input object is a data value (an instance of a DataType), then a copy of the input data value is placed on the output pin, but with the appropriate structural feature modified. As a data value does not have an independent identity, the only way to obtain the modified data value is through the use of the result OutputPin.
读结构特征动作读取结构特征的值并将这些值放到result输出引脚上。其他种类的结构特征动作,写结构特征动作(包括增加结构特征值动作和移除结构特征值动作)和清除结构特征动作会修改结构特征。这些动作可能会包含一个可选的result输出引脚。如果存在这个输出引脚,那么修改后的对象会被放到这个输出引脚上。如果输入对象是数据对象(某个DataType的实例),那么输入数据的拷贝会被放到输出引脚上,但是对应的结构特征被修改该过了。因为数据值没有独立的识别信息,获得修改后数据的唯一方法就是通过使用result输出引脚。
16.8.3.2 Read Structural Feature Actions(读结构特征动作)
A ReadStructuralFeatureAction is a StructuralFeatureAction that retrieves the values of a StructuralFeature and places them on its result OutputPin. If the StructuralFeature is ordered, then the values are placed on the OutputPin in order. If the StructuralFeature is an Association end, the semantics are the same as a ReadLinkAction with the StructuralFeature as the open end (see sub clause 16.6). If there are no retrieved values (that is, the StructuralFeature is empty), then a ReadStructuralFeatureAction produces a single null token on its result OutputPin.
读结构特征动作读取结构特征的值并将它们放到result输出引脚上。如果结构特征是有序的,那么放到输出引脚上的值也是有序的。如果结构特征是一个关联端,那么它的语义和读链接动作在以结构特征为开放端(参见16.6小节)时一样。如果没有取到值(也就是说结构特征为空),读结构特征动作会在result输出引脚上生成一个空令牌。
The type and ordering of the result OutputPin are the same as those of the StructuralFeature. The multiplicity of the StructuralFeature must be compatible with the multiplicity of the result OutputPin, but does not have to be the same. For example, the modeler can set the multiplicity of this OutputPin to support multiple values even when the StructuralFeature only allows a single value (this way, the ReadStructuralFeatureAction as modeled will be unaffected by changes in the multiplicity of the StructuralFeature).
result输出引脚的类型和有序性和结构特征保持一致。结构特征的多重度必须和result输出引脚的多重度兼容。例如,建模者可以设定输出引脚的多重度以支持多值,即使结构特征只支持单值(这样建模得到的读结构特征动作就不会受到结构特征多重度变化的影响)
16.8.3.3 Add Structural Feature Value Actions(增加结构特征值动作)
An AddStructuralFeatureValueAction is a StructuralFeatureAction for adding a value to a StructuralFeature of an object. The value to be added is given on the value InputPin, which is required. This InputPin has the same type as the
StructuralFeature and a multiplicity of 1..1 (that is, a single value is added). If the StructuralFeature is an Association end, the semantics are the same as for a CreateLinkAction (see sub clause 16.6), where the participants in the link are the object being acted on and the new value.
增加结构特征值动作向一个对象的结构特征增加一个值。增加的值通过value输入引脚传递,而这个引脚是必需的。这个输入引脚和结构特征具有相同的类型,多重都为1..1(也就是说增加的是单值)。如果结构特征是一个关联端,增加结构特征值的语义和生成链接动作(参见16.6小节)相同。这里链接的参与者是操作的目的对象和新值。
If isReplaceAll is true, then the existing values of the StructuralFeature are removed before the new value is added, except if the StructuralFeature already contains the new value, in which case it is not removed under this option. The
StructuralFeature always has a single value when the Action completes, even if the lower multiplicity of the StructuralFeature is greater than 1. If isReplaceAll is false and the StructuralFeature is unordered and unique, then adding a value that is already contained in the StructuralFeature has no effect.
如果isRelaceAll为真,在新值被增加到结构特征之前,已经存在的值会被移除。除非结构特征已经包含这个新值,在这种情况下它不会受这个选项的影响而被移除。当动作结束时,结构特征总是保有一个唯一的值,哪怕结构特征的多重度大于1。如果isReplace为假且结构特征是无序和不允许重复的,增加一个已经存在的值对结构特征没有影响。
Adding a value to an ordered StructuralFeature requires an insertion point for the new value given in the insertAt InputPin, which is required for ordered StructuralFeatures when isReplaceAll is false and omitted for unordered
StructuralFeatures.
向一个有序的结构特征增加一个值需要通过insertAt输入引脚提供插入点。这个输入引脚在结构特征有序而且isReplaceAll为假时有效,在结构特征无序时被忽略。
NOTE. Values of StructuralFeatures may be ordered even if the upper multiplicity is 1.
注意:结构特征的值在多重度上限为1时也可能是有序的。
If the insertAt InputPin is present, it has type UnlimitedNatural and multiplicity 1..1. An insertion point that is a positive integer less than or equal to the current number of values means to insert the new value at that position in the sequence of existing values, with the integer 1 meaning the new value will be first in the sequence. A value of unlimited (“*”) for the insertion point means to insert the new value at the end of the sequence. The semantics are undefined for a value of 0 or an integer greater than the number of existing values. Reinserting an existing value at a new position in an ordered, unique StructuralFeature moves the value to that position (this works because such StructuralFeature values are ordered sets). The insertion point is ignored if it is used when isReplaceAll=true.
如果存在insertAt输入引脚,那么它的类型为无限自然数,多重度为1..1。一个小于或等于值数目的正整数插入点意味着在已存在的值序列中插入值,而整数1意味着在序列的第一个位置插入。插入点为无限(”*“)意味着在序列的结尾插入值。0或者大于值数目的插入点值没有定义。向一个有序的,不允许重复的结构特征的新位置重新插入一个已有值的结果是将该值移动到新位置(产生这个结果是因为结构特征的值是有序集合)。当isReplaceAll为真时,插入点会被忽略。
The semantics are undefined for adding a value that violates the upper multiplicity of the StructuralFeature, and for adding a new value to a StructuralFeature with isReadonly=true after initialization of the object that would have the
value.
超过结构特征多重度的上限增加一个值或者对象初始化以后向它的只读结构特征增加值的语义都是无定义的。
16.8.3.4 Remove Structural Feature Value Actions(移除结构功能值动作)
A RemoveStructuralFeatureValueAction is a StructuralFeatureAction for removing a value from a StructuralFeature of an object. If the feature is an Association end, the semantics are the same as for DestroyLinkAction, where the participants in the link are the object and the value being removed.
移除结构特征值动作移除一个对象的结构特征值。如果特征是一个关联端,那么它的语义和链接的参与者为对象和移除目标值时的销毁链接动作一样。
Except as given below, the value to be removed is given on the value InputPin, which has the same type as the StructuralFeature and a multiplicity of 1..1. The value is removed even when this results in a violation of the lower
multiplicity of the StructuralFeature. Removing a value that is not contained in the StructuralFeature has no effect. The isRemoveDuplicates option indicates whether to remove all duplicates of the specified value in non-unique StructuralFeatures.
除了后面给出的情况,移除目标值都是通过value输入引脚给定的。它的类型和结构特征相同,多重度为1..1。即使结果会导致违反结果特征的多重度下限要求,值还是会被移除。移除一个没有包含在结构特征中的值不会造成影响。isRemoveDulicates选项表明是否移除允许重复的结构特征中所有的重复值。
If isRemoveDuplicates is false and the StructuralFeature is ordered and non-unique, then there is no value InputPin, and the value to be removed is instead specified by giving its position on the removeAt InputPin, which has type
UnlimitedNatural and a multiplicity of 1..1. A removal position that is a positive integer less than or equal to the current number of values means to remove the value at that position in the sequence of existing values, with the integer 1
meaning the first value in the sequence. The semantics are undefined for 0, an integer greater than the number of existing values, and unlimited (“*”).
如果isRemoveDuplicates为假,结构特征有序且允许重复值,那么就不需要value输入引脚,作为代替手段,移除对象是通过removeAt输入引脚传递的位置决定的。removeAt引脚的类型为无限自然数,多重度为1..1。小于或等于当前值数目的移除点意味着从已有值系列中移除值,这里整数1的意义是序列的第一个位置。0,大于已有值数目的整数和无限(“*”)的语义无定义。
The semantics are undefined for removing an existing value of a StructuralFeature with readOnly=true after initialization of the owning object.
当拥有它的对象初始化以后,从一个readOnly为true的结构特种移除已有值的语义无定义。
16.8.3.5 Clear Structural Feature Actions(清除结构特征动作)
A ClearStructuralFeatureAction is a StructuralFeatureAction that removes all values of a StructuralFeature, even if lower multiplicity of the StructuralFeature is greater than 0. The action has no effect if the StructuralFeature has no
values. If the StructuralFeature is an Association end, the semantics are the same as for a ClearAssociationAction on the given object.
清除结构特征动作移除结构特征的全部的值,哪怕结构特征的下限大于0。当结构特征不包含值时,动作不产生影响。如果结构特征是一个关联端,清除结构特征动作的语义和对给定对象调用清除关联动作相同。
The semantics are undefined for a StructuralFeature with isReadOnly = true after initialization of the object owning the StructuralFeature, unless the StructuralFeature has no values.
当拥有结构特征的对象被初始化以后,对isReadOnly为true的结构特征调用清除结构特征动作的语义无定义,除非这个结构特征不包含值。
以上是“EA画UML活动图中Structural Feature Actions的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。