如何在 UML 状态机中描述 return 语句?

How do I depict a return statement in an UML state machine?

是否可以将 return 语句显示为 UML 状态图中的转换描述?

是否有定义的语法或约定?

示例: int doSomething()

状态 1 --- return doSomething() ---> 状态 2

我没有找到任何适合这个主题的东西,如果 OMG UML 规范写在那里,我也不会去阅读它。 我唯一找到的是这个

Paper on Modelling Recursive Calls with UML State Diagrams.

作者使用 方法状态机 来跟踪方法的状态。但我想知道如何将其写成 action,例如使用具有 return 值的函数而不是跟踪方法所处的特定状态。

"normal" 州没有 return。一个国家不记得它来自哪里。但是,有一个概念 State history(第 307 页,当前 UML 2.5 规范):

The concept of State history was introduced by David Harel in the original statechart formalism. It is a convenience concept associated with Regions of composite States whereby a Region keeps track of the state configuration it was in when it was last exited. This allows easy return to that same state configuration, if desired, the next time the Region becomes active (e.g., after returning from handling an interrupt), or if there is a local Transition that returns to its history. This is achieved simply by terminating a Transition on the desired type of history Pseudostate inside the Region. The advantage provided by this facility is that it eliminates the need for users to explicitly keep track of history in cases where this type of behavior is desired, which can result in significantly simpler state machine models.

以此为例:

每当转换到 State1 时,都会保存 State2 的当前子状态。过渡到 H 标记的小圆圈将恢复以前的子状态(State34)。