Package | org.puremvc.as3.utilities.statemachine |
Class | public class StateMachine |
Inheritance | StateMachine ![]() |
Handles regisistration and removal of state definitions, which include optional entry and exit commands for each state.
Property | Defined by | ||
---|---|---|---|
canceled : Boolean
The transition has been canceled.
| StateMachine | ||
currentState : State
Get the current state.
| StateMachine | ||
initial : State
The initial state of the FSM.
| StateMachine | ||
states : Object
Map of States objects by name.
| StateMachine |
Method | Defined by | ||
---|---|---|---|
Constructor.
| StateMachine | ||
handleNotification(note:INotification):void
Handle notifications the
StateMachine is interested in. | StateMachine | ||
listNotificationInterests():Array
Notification interests for the StateMachine.
| StateMachine | ||
onRegister():void
| StateMachine | ||
registerState(state:State, initial:Boolean = false):void
Registers the entry and exit commands for a given state.
| StateMachine | ||
removeState(stateName:String):void
Remove a state mapping.
| StateMachine |
Method | Defined by | ||
---|---|---|---|
transitionTo(nextState:State, data:Object = null):void
Transitions to the given state from the current state.
| StateMachine |
Constant | Defined by | ||
---|---|---|---|
ACTION : String [static]
Action Notification name.
| StateMachine | ||
CANCEL : String [static]
Cancel Notification name
| StateMachine | ||
CHANGED : String [static]
Changed Notification name
| StateMachine | ||
NAME : String = "StateMachine" [static]
| StateMachine |
canceled | property |
protected var canceled:Boolean
The transition has been canceled.
currentState | property |
currentState:State
[read-write]Get the current state.
Implementation protected function get currentState():State
protected function set currentState(value:State):void
initial | property |
protected var initial:State
The initial state of the FSM.
states | property |
protected var states:Object
Map of States objects by name.
StateMachine | () | constructor |
public function StateMachine()
Constructor.
handleNotification | () | method |
public override function handleNotification(note:INotification):void
Handle notifications the StateMachine
is interested in.
StateMachine.ACTION
: Triggers the transition to a new state.
StateMachine.CANCEL
: Cancels the transition if sent in response to the exiting note for the current state.
note:INotification |
listNotificationInterests | () | method |
public override function listNotificationInterests():Array
Notification interests for the StateMachine.
ReturnsArray |
onRegister | () | method |
public override function onRegister():void
registerState | () | method |
public function registerState(state:State, initial:Boolean = false):void
Registers the entry and exit commands for a given state.
Parametersstate:State — the state to which to register the above commands
|
|
initial:Boolean (default = false ) — boolean telling if this is the initial state of the system
|
removeState | () | method |
public function removeState(stateName:String):void
Remove a state mapping.
Removes the entry and exit commands for a given state as well as the state mapping itself.
ParametersstateName:String |
transitionTo | () | method |
protected function transitionTo(nextState:State, data:Object = null):void
Transitions to the given state from the current state.
Sends the exiting
notification for the current state
followed by the entering
notification for the new state.
Once finally transitioned to the new state, the changed
notification for the new state is sent.
If a data parameter is provided, it is included as the body of all three state-specific transition notes.
Finally, when all the state-specific transition notes have been
sent, a StateMachine.CHANGED
note is sent, with the
new State
object as the body
and the name of the
new state in the type
.
nextState:State — the next State to transition to.
|
|
data:Object (default = null ) — is the optional Object that was sent in the StateMachine.ACTION notification body
|
ACTION | constant |
public static const ACTION:String
Action Notification name.
CANCEL | constant |
public static const CANCEL:String
Cancel Notification name
CHANGED | constant |
public static const CHANGED:String
Changed Notification name
NAME | constant |
public static const NAME:String = "StateMachine"