A state machine
describes the behaviour of an object in terms of
events that affect the object and the
state of the object between events
状态机定义了在不同事件之间对象的行为和状态
State(状态)
State(“状态”),就是一个系统在其生命周期中某一时刻的运行情况,此时,系统会执行一些动作,或者等待一些外部输入。
Event(事件)
Event(“事件”),就是在一定的时间和空间上发生的对系统有意义的事情。
Guard(条件)
状态机对外部消息进行响应的时候,除了需要判断当前的状态,还要判断
跟这个状态相关的一些条件是否成立。这种判断称为guard(“条件”)。guard
通过允许或者禁止某些操作来影响状态机的行为。
Transition(迁移)
从一个状态切换到另一个状态被称为Transition(“迁移”)。引起状态迁移的事件被称为triggering event (“触发事件”),或者被简称为trigger (“触发”)。
state-dependent object:
Reacts differently to events depending on the object’s state会根据event不同作出不同的反应
state-independent object:
For all events of interest, an object always reacts to the event the same way所有的event都只会有一种反应


在state a下,根据条件(guard)触发了trainsition

网友评论