股明星型转变的优先级
我目前正在撰写通用的statemachine。但是我有一些理解的问题。
假设我有一个状态A。如果满足条件,则A向B过渡。 A还具有A1的替代。如果满足条件,则A1过渡到状态C。
如果满足两个条件并且主动状态为A1,我是否会过渡到B或C? 另外,我还必须运行A的重复运行任务,因为A在技术上也很活跃?
I am currently writing a generic statemachine. But I have a couple of understanding problems.
Say I have a state A. A transitions to B if a condition is met.
A also has a substate A1. A1 transitions to state C if a condition is met.
Do I transition to B or C if both conditions are met and the active state is A1?
Also do I have to run the repetitive running task of A since A is technically also active?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了使状态机成为确定性的,给定状态的所有转换(包括它的“子状态”,实际上只是定义具有类似转换的状态的简写)必须是互斥的。如果它们不互斥,那么您就有一个非确定性状态机。这样的机器是完全合理的,但更难评估——在任何给定时间它可以处于任何状态集(而不仅仅是单个状态),并且从当前状态集中的任何状态可能发生的每个转换都是与寻找下一组状态相关。因此,在您的示例中,您将从状态 {A1} 变为状态 {B,C}
In order for a state machine to be Deterministic, all the transitions out of a given state (including it's 'substates' which is really just a shorthand for defining states with similar transitions) must be mutually exclusive. If they are not mutually exclusive, you have a Non-Deterministic state machine. Such machines are perfectly reasonable, but harder to evaluate -- at any given time it can be in any set of states (rather than just a single state), and every transition that is possible from any of states in the current set of states is relevant for finding the next set of states. So in your example, you would go from being in states {A1} to states {B,C}
经过更多研究后,我发现这篇文章回答了我在第 2.10 章中的问题。
Crashcourse UML Statemachines
很快,这取决于哪个事件首先发生,超时还是第二个事件。
After some more research I found this article that answers my question in chapter 2.10.
Crashcourse UML Statemachines
Shortly it depends which event occurs first, the timeout or the second event.