转换到之前的状态
我正在设计一个状态机,并且有一个可以从两个不同状态进入的特定状态...我不确定如何返回到前一个状态...或者我建模错误了吗?
说明一下:
| state | trigger | nextstate --------------------------------- 1. | initial | evtX | A 2. | initial | evtY | B 3. | B | evtX | A 4. | A | evtZ | ????
最后一行是我遇到麻烦的地方。如果 A 是从第 1 行的转换到达的,我需要转换到初始状态,如果 A 是从第 3 行的转换到达的,我需要转换到状态 B。
我怎样才能更好地建模?
I am designing a state-machine and have one specific state that I can enter from two different states... I am not sure how to go back to the previous state... or am I modeling it wrong ?
to illustrate :
| state | trigger | nextstate --------------------------------- 1. | initial | evtX | A 2. | initial | evtY | B 3. | B | evtX | A 4. | A | evtZ | ????
The last row is where I am having trouble. I need to transition to initial state, if A was arrived at from the transiton in row number 1 and I need to transition to state B, if A was arrived at from transition in row number 3.
How can i model this better ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,您有两种不同的 A 状态:
如果您想要更强大的东西,请尝试使用 Harel/UML 状态图(其中具有“超级状态、正交区域和作为状态一部分的活动”[1])。您可能会看一下在 SCXML 上 [2],但我不知道其中任何一个
。 rel="nofollow">http://en.wikipedia.org/wiki/Harel_statechart#Harel_statechart
[2] http://en.wikipedia.org/wiki/SCXML
In fact, you have two different A states:
If you want something more powerful, try with Harel/UML statecharts (which have 'superstates, orthogonal regions, and activities as part of a state" [1]). You might have a look at SCXML as weel [2]. I don't know any of them though.
[1] http://en.wikipedia.org/wiki/Harel_statechart#Harel_statechart
[2] http://en.wikipedia.org/wiki/SCXML