new module:ct-workbench /model /Mini State Machine(mStates, sInitial State)
The MiniStateMachine provides a simple configurable state Machine. You must provide a valid representation of the state model the MiniStateMachine will be in.
The format will be a map, with each key representing a state, and an array of valid states that can be transitioned to as the value
mStates["state1"] = ["state2", "state3"]
mStates["state2"] = ["steate1"]
mStates["state3"] = ["state1", "state2"]
Parameters:
Name | Type | Description |
---|---|---|
mStates |
Object | Representation of the states the MinisStateMachine will use. |
sInitialState |
String | Initial state your MiniStateMachine is on. |
Methods
get Available States()
Returns the available states that the MiniStateMachine can be in.
get Current State()
Returns the current MiniStateMachine state.
get Valid Transitions(The)
Returns the available states that can be transitioned from the state given. If no state is given it will return the available transitions from the current state.
Parameters:
Name | Type | Description |
---|---|---|
The |
String | state from which we want to know the transitions |
set State(sNew State)
Sets the given state. This state must be within the available ones.
Parameters:
Name | Type | Description |
---|---|---|
sNewState |
String | The new state to be set |