EA&UML日拱一卒-活動圖::14.2 Behavior StateMachines (5)
英文原文來自UML2.5,作者提供中文翻譯。
14.2.3.5 ConnectionPointReference(連接點引用)
As noted above, a connection point reference represents a usage (as part of a submachine State) of an entry/exit point defined in the StateMachine referenced by the submachine State. Connection point references of a submachine State can be used as sources/targets of Transitions. They represent entries into or exits out of the submachine StateMachine referenced by the submachine State.
就像前面提到的那樣,連接點引用表現(xiàn)的是子狀態(tài)機狀態(tài)對于定義在狀態(tài)機中的進入/退出點的引用。子狀態(tài)機狀態(tài)的連接點引用可以用作遷移源和遷移目標。連接點引用表現(xiàn)的是被子狀態(tài)機狀態(tài)引用的進入子狀態(tài)機的入口和離開子狀態(tài)機的出口。
Connection point references are sources/targets of Transitions implying exits out of/entries into the submachine StateMachine referenced by a submachine State.
連接點引用是遷移源或遷移目標意味著離開子狀態(tài)機的出口的和進入子狀態(tài)機的入口被子狀態(tài)機狀態(tài)引用。
An entry point connection point reference as the target of a Transition implies that the target of the Transition is the entryPoint Pseudostate as defined in the submachine of the submachine State. As a result, the Regions of the submachine StateMachine are entered through the corresponding entryPoint Pseudostates.
進入點連接點引用作為遷移的目標意味著遷移目標是定義在子狀態(tài)機狀態(tài)中的狀態(tài)機的進入點偽狀態(tài)。作為結(jié)果,子狀態(tài)機的區(qū)域通過對應(yīng)的進入點偽狀態(tài)被進入。
An exit point connection point reference as the source of a Transition implies that the source of the Transition is the exit point Pseudostate as defined in the submachine of the submachine State that has the exit point connection point defined. When a Region
of the submachine StateMachine reaches the corresponding exit point, the submachine state is exited via this exit point.
退出點連接點引用作為遷移的源意味著遷移的源是定義在子狀態(tài)機狀態(tài)中里的狀態(tài)機中的退出點偽狀態(tài)。當子狀態(tài)機到達了對應(yīng)的退出點,子狀態(tài)機狀態(tài)也從退出點退出。
14.2.3.6 FinalState(完了狀態(tài))
FinalState is a special kind of State signifying that the enclosing Region has completed. Thus, a Transition to a FinalState represents the completion of the behaviors of the Region containing the FinalState.
完了狀態(tài)是一種特殊的狀態(tài),表明包含它的區(qū)域已經(jīng)結(jié)束。就是說,遷移到完了狀態(tài)表示包含完了狀態(tài)的區(qū)域的行為已經(jīng)結(jié)束。
14.2.3.7 Pseudostate and PseudostateKind(偽狀態(tài)和偽狀態(tài)種類)
A Pseudostate is an abstraction that encompasses different types of transient Vertices in the StateMachine graph. Pseudostates are generally used to chain multiple Transitions into more complex compound transitions (see below). For
example, by combining a Transition entering a fork Pseudostate with a set of Transitions exiting that Pseudostate, we get a compound Transition that can enter a set of orthogonal Regions.
偽狀態(tài)是一種抽象,它包括了狀態(tài)機圖中各種瞬間通過的頂點。偽頂點通常被用于將多個遷移連接成更加復(fù)雜的復(fù)合遷移(參考下面的說明)。例如,利用將一個進入分叉?zhèn)螤顟B(tài)的遷移和一組離開該分叉?zhèn)螤顟B(tài)的遷移組合起來,可以得到用來進入正交區(qū)域的復(fù)合遷移。
The specific semantics of a Pseudostate depend on the kind of Pseudostate, which is defined by its kind attribute of type PseudostateKind. The following describes the different kinds and their semantics:
偽狀態(tài)的具體語義依賴于偽狀態(tài)的種類,這是通過狀態(tài)的類型為PsudostateKind的種類屬性來定義的。
? initial - An initial Pseudostate represents a starting point for a Region; that is, it is the point from which execution of its contained behavior commences when the Region is entered via default activation. It is the source for at most one Transition, which may have an associated effect Behavior, but not an associated trigger or guard. There can be at most one initial Vertex in a Region.
初始-初始偽狀態(tài)表現(xiàn)了區(qū)域的開始點;也就是說,當以默認激活的方式進入?yún)^(qū)域時,它是區(qū)域中包含的活動開始執(zhí)行的位置。它最多是一個遷移的源,這個遷移可以有效果行為,但不能有關(guān)聯(lián)的觸發(fā)條件或監(jiān)護條件。一個區(qū)域中最多只能有一個初始頂點。
? deepHistory – This type of Pseudostate is a kind of variable that represents the most recent active state configuration of its owning Region. As explained above, a Transition terminating on this Pseudostate implies restoring the Region to that same state
configuration, but with all the semantics of entering a State (see the sub clause describing State entry). The entry Behaviors of all States in the restored state configuration are performed in the appropriate order starting with the outermost State. A deepHistory
Pseudostate can only be
defined for composite States and, at most one such Pseudostate can be contained in a Region of a composite State.
深 歷史-這種偽狀態(tài)是一種變量,保存的是包含它的區(qū)域在最近被激活時的狀態(tài)構(gòu)成。如前面所講,遷移進入這個偽狀態(tài)就意味著將區(qū)域恢復(fù)到與最近離開時相同的狀 態(tài)構(gòu)成,伴隨著所有進入狀態(tài)的語義(參見狀態(tài)進入的小節(jié))。被恢復(fù)狀態(tài)的所有進入行為被從最外層狀態(tài)開始按照恰當?shù)捻樞驁?zhí)行。深歷史偽狀態(tài)只能在組合狀態(tài) 中被定義,而且組合狀態(tài)的一個區(qū)域中最多只能定義一個。
? shallowHistory – As explained above, this type of Pseudostate is a kind of variable that represents the most recent active substate of its containing Region, but not the substates of that substate. A Transition terminating on this Pseudostate implies restoring the Region to that substate with all the semantics of entering a State. A single outgoing Transition from this Pseudostate may be defined terminating on a substate of the composite State. This substate is the default shallow history state of the composite State. A shallowHistory Pseudostate can only be defined for composite States and, at most one such Pseudostate can be included in a Region of a composite State.
淺歷史-如前面所講,這類偽狀態(tài)是一個變量,保存了包含它的區(qū)域的最近的活動子 狀態(tài)。但不包含這個子狀態(tài)的(下級)子狀態(tài)。遷移到這個偽狀態(tài)意味著將區(qū)域恢復(fù)到該子狀態(tài),同時伴隨著進入狀態(tài)的語義。可以有一條離開該偽狀態(tài)指向組合狀 態(tài)里的某個子狀態(tài)的遷移。這個子狀態(tài)是組合狀態(tài)的默認淺歷史狀態(tài)。淺歷史偽狀態(tài)只能在組合狀態(tài)中被定義,而且組合狀態(tài)的一個區(qū)域中最多只能定義一個。
? join – This type of Pseudostate serves as a common target Vertex for two or more Transitions originating from Vertices in different orthogonal Regions. Transitions terminating on a join Pseudostate cannot have a guard or a?
trigger. Similar to junction points in Petri nets, join Pseudostates perform a synchronization function, whereby all incoming Transitions have to complete before execution can continue through an outgoing Transition.?
匯合-這種類型的偽狀態(tài)為兩個或多個來自不同頂點的遷移提供目 標頂點,而這些源頂點處于不同的正交區(qū)域中。終止于匯合偽狀態(tài)的遷移不允許有監(jiān)護條件和觸發(fā)條件。類似于Petri網(wǎng)絡(luò)中的接合點,匯合偽節(jié)點實現(xiàn)同步功 能,只有在所有的進入遷移都完成以后,才能繼續(xù)進行離開遷移。
? fork – fork Pseudostates serve to split an incoming Transition into two or more Transitions terminating on Vertices in orthogonal Regions of a composite State. The Transitions outgoing from a fork Pseudostate cannot have a guard or a trigger.
分叉-分叉?zhèn)螤顟B(tài)將一個進入遷移分成兩個或多個遷移,它們終止于組合狀態(tài)的(不同的)正交區(qū)域。離開分叉?zhèn)螤顟B(tài)的遷移不可以有監(jiān)護條件和觸發(fā)條件。
? junction – This type of Pseudostate is used to connect multiple Transitions into compound paths between States. For example, a junction Pseudostate can be used to merge multiple incoming Transitions into a single outgoing Transition representing a shared continuation path. Or, it can be used to split an incoming Transition into multiple outgoing Transition segments with different guard Constraints.
連接點-這種類型的偽狀態(tài)用于將狀態(tài)之間的多個遷移連接成復(fù)合路徑。例如,合并偽狀態(tài)可以用來將多個進入遷移合并成一個離開遷移,通過這種方式表現(xiàn)后續(xù)路徑分享。也可以用于將一個進入遷移分成多個離開遷移,這些離開遷移通過不同的監(jiān)護約束選擇。
NOTE. Such guard Constraints are evaluated before any compound transition containing this Pseudostate is executed, which is why this is referred to as a static conditional branch.?
注意:這樣的監(jiān)護約束的演算是在包含這個偽狀態(tài)的復(fù)合遷移執(zhí)行之前進行的,這就是為什么它被稱為靜態(tài)條件路徑。
It may happen that, for a particular compound transition, the configuration of Transition paths and guard values is such that the compound transition is prevented from reaching a valid state configuration. In those cases, the entire compound transition is disabled even though its Triggers are enabled. (As a way of avoiding this situation in some cases, it is possible to associate a predefined guard denoted as “else” with at most one outgoing Transition. This Transition is enabled if all the guards attached to the other Transitions evaluate to false). If more than one guard evaluates to true, one of these is chosen. The algorithm for making this selection is not defined.
可能發(fā)生這樣的事情,對于一個具體的復(fù)合遷移,遷移路徑和監(jiān)護條件的構(gòu)成導(dǎo)致無法到達某個有效的狀態(tài)構(gòu)成。在這 種情況下,即使觸發(fā)條件的是有效的,整個復(fù)合遷移也是無效的。(作為避免某種情況下出現(xiàn)這種局面的方法,可以為最多一個離開遷移關(guān)聯(lián)事先定義的表示為 “else”的監(jiān)護條件,這個遷移在所有其他遷移的監(jiān)護條件的結(jié)果為假時有效)。如果多于一個監(jiān)護條件的結(jié)果為真,其中一個會被選中,但做出這種選擇的算 法無定義。
? choice – This type of Pseudostate is similar to a junction Pseudostate (see above) and serves similar purposes, with the difference that the guard Constraints on all outgoing Transitions are evaluated dynamically, when the compound transition traversal reaches this Pseudostate. Consequently, choice is used to realize a dynamic conditional branch. It allows splitting of compound transitions into multiple alternative paths such that the decision on which path to take may depend on the results of Behavior executions performed in the same compound transition prior to reaching the choice point. If more than one guard evaluates to true, one of the corresponding Transitions is selected. The algorithm for making this selection is not defined. If none of the guards evaluates to true, then the model is considered ill formed. To avoid this, it is recommended to define one outgoing Transition with the predefined “else” guard for every choice Pseudostate.
選擇-這種類型的偽狀態(tài)和連接點偽狀態(tài)(參見前面)相似,而且具有類似的用途。有一點 不同就是離開遷移上的監(jiān)護約束是當復(fù)合遷移到達這個偽狀態(tài)時動態(tài)演算的。因此,選擇用于識別動態(tài)條件分支。它允許將復(fù)合遷移分成多個可選的分支,判斷采用 那條路徑時可以根據(jù)處于同一個復(fù)合遷移中的行為在遷移到達該選擇點之前的執(zhí)行結(jié)果。如果多于一個監(jiān)護條件的演算結(jié)果為真,其中的一個遷移會被選中,但是進 行這個選擇的算法無定義。如果沒有監(jiān)護條件的演算結(jié)果為真,那么這個模型被認為是病態(tài)。為了避免這種情況,推薦為所有的選擇偽狀態(tài)設(shè)置一個預(yù)先定義的
“else”離開遷移。
? entryPoint – An entryPoint Pseudostate represents an entry point for a StateMachine or a composite State that provides encapsulation of the insides of the State or StateMachine. In each Region of the StateMachine or
composite State owning the entryPoint, there is at most a single Transition from the entry point to a Vertex within that Region.
進入點-進入點偽狀態(tài)表示的是狀態(tài)機或者封裝了內(nèi)部狀態(tài)/狀態(tài)機的組合狀態(tài)的入口點。在包含入口點的狀態(tài)機或者組合狀態(tài)的每個區(qū)域中,最多可以有一個從入口點到區(qū)域內(nèi)頂點的遷移。
NOTE. If the owning State has an associated entry Behavior, this Behavior is executed before any behavior associated with the outgoing Transition. If multiple Regions are involved, the entry point acts as a fork Pseudostate.
注意:如果擁有入口點的狀態(tài)關(guān)聯(lián)了入口行為,這個行為在離開遷移的任何關(guān)聯(lián)行為之前執(zhí)行。如果多個區(qū)域被調(diào)用,入口點的行為和分叉?zhèn)螤顟B(tài)一樣。
? exitPoint – An exitPoint Pseudostate is an exit point of a StateMachine or composite State that provides encapsulation of the insides of the State or StateMachine. Transitions terminating on an exit point within any Region of the composite State or a StateMachine referenced by a submachine State implies exiting of this composite State or submachine State (with execution of its associated exit Behavior). If multiple Transitions from orthogonal Regions within the State terminate on this Pseudostate, then it acts like a join Pseudostate.
退出點-退出點偽狀態(tài)表示的是狀 態(tài)機或者封裝了內(nèi)部狀態(tài)/狀態(tài)機的組合狀態(tài)的退出點。遷移到組合狀態(tài)或者是被子狀態(tài)機狀態(tài)引用的狀態(tài)機中的區(qū)域中的退出點意味著組合狀態(tài)或者是子狀態(tài)機狀 態(tài)的退出(伴隨著關(guān)聯(lián)退出行為的執(zhí)行)。如果存在多個從狀態(tài)機中的正交區(qū)域到這個偽狀態(tài)的遷移,那么它的行為像匯合點偽狀態(tài)一樣。
? terminate – Entering a terminate Pseudostate implies that the execution of the StateMachine is terminated immediately. The StateMachine does not exit any States nor does it perform any exit Behaviors. Any executing doActivity Behaviors are automatically aborted. Entering a terminate Pseudostate is equivalent to invoking a DestroyObjectAction.
終止-進入終止偽狀態(tài)意味著狀態(tài)機的執(zhí)行立即終止。狀態(tài)機不會退出任何狀態(tài),也不會執(zhí)行任何退出行為。任何執(zhí)行中的doActivity行為被自動地中止。進入終止偽狀態(tài)等同于調(diào)用刪除對象動作。
參考資料:
《OMG Unified Modeling Language TM (OMG UML) Version 2.5》
? URL:http://www.omg.org/spec/UML/2.5
閱讀更多更新文章,請掃描下面二維碼,關(guān)注微信公眾號【面向?qū)ο笏伎肌?