您好,登錄后才能下訂單哦!
這篇文章主要介紹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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。