Caplin Trader 5.1.0

Class: module:ct-workbench/model/MiniStateMachine

module:ct-workbench/model/MiniStateMachine(mStates, sInitialState)

new module:ct-workbench/model/MiniStateMachine(mStates, sInitialState)

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"]
Name Type Description
mStates Object

Representation of the states the MinisStateMachine will use.

sInitialState String

Initial state your MiniStateMachine is on.



Returns the available states that the MiniStateMachine can be in.


Returns the current MiniStateMachine state.


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.

Name Type Description
The String

state from which we want to know the transitions


Sets the given state. This state must be within the available ones.

Name Type Description
sNewState String

The new state to be set