(翻譯)活動圖::Structural Feature Actions
本文是UML2.5規範英文版中關於結構特徵動作的內容,這裡將其翻譯成中文,供參考。
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的結構特徵調用清除結構特徵動作的語義無定義,除非這個結構特徵不包含值。
參考資料:
《OMG Unified Modeling Language TM (OMG UML) Version 2.5》
URL:UML 2.5
以上就是今天的文章,歡迎點贊,關注並推薦給您的朋友!
閱讀更多更新文章,請關注【面向對象思考】微信公眾號!
推薦閱讀:
※在軟體開發過程中,有哪些UML圖是比較常用的?
※如何反駁 UML 無用論?
※(翻譯)13.1 Summary
※業務實時監控的統一抽象