UML 状态图深入研究与内部转换

UML Statechart Delving Into vs Internal Transition

我对下面的状态图有疑问;

我想,在 UML 中,这是可能的。在这种情况下,执行顺序是S1进入,S3进入。我对吗? 在下图中,发生从“任何其他状态”到 s1 的转换时的执行顺序是什么?

第一个图表:

execution order is S1 enter, S3 enter. Am I right?

是的,你是对的,来自标准 formal/2017-12-05 § 14.2.3.4.5 进入状态 第 310 页:

Explicit entry: If the incoming Transition or its continuations terminate on a directly contained substate of the composite State, then that substate becomes active and its entry Behavior is executed after the execution of the entry Behavior of the containing composite State.

第二张图:

  • 它似乎使用了一个入口点伪状态(画得不好),但是从任何其他状态的转换是不是去它而是去 S1,所以到 初始伪状态 ,执行是 entryActS1 然后 entryActS2 .

  • 如果它不是入口点,而是从边界开始的局部转换,与任何其他状态没有任何变化,并且执行也是entryActS1 然后 entryActS2.


关于过渡表示内部

从可能的 entryPoint 伪状态 或从边界的转换被指示为 internal,但内部转换是自转换,其中源和目标是相同的状态,如标准 formal/2017-12-05 §14.2.3.8.1 中所述 相对于源的过渡类型 第 314 页:

kind = internal is a special case of a local Transition that is a self-transition (i.e., with the same source and target States), such that the State is never exited (and, thus, not re-entered), which means that no exit or entry Behaviors are executed when this Transition is executed. This kind of Transition can only be defined if the source Vertex is a State.

所以第二张图是非法的:

  • entry pseudatestate 而不是 internal 的情况下,从它的过渡是 local 如标准 formal/2017-12-05 § 14.5.11.8 约束 第 361 页所述:

state_is_local

A Transition with kind local must have a composite State or an entry point as its source.

  • 如果从边界过渡,它可以是 localexternal,但绘制时它是 local,请参阅标准 formal/2017-12-05 第 335 页图 14.34 Local Transitions 和图 14.35 External Transitions 以查看绘图的差异