Options
All
  • Public
  • Public/Protected
  • All
Menu

state

Index

Variables

internalTransitionsTriggerCompletion

internalTransitionsTriggerCompletion: boolean = false

Flag to make internal Transitions trigger completion events for State they are in.

Functions

FalseFunc

  • FalseFunc(): boolean

TrueFunc

  • TrueFunc(): boolean

evaluate

  • evaluate(model: StateMachine, instance: IInstance, message: any, autoInitialiseModel?: boolean): boolean
  • Passes a message to a state machine instance for evaluation; a message may trigger a Transition.

    Parameters

    • model: StateMachine

      The StateMachine model.

    • instance: IInstance

      The state machine instance.

    • message: any

      The message to evaluate.

    • Default value autoInitialiseModel: boolean = true

      Defaulting to true, this will cause the StateMachine model to be initialised prior to initialising the instance if the model has changed.

    Returns boolean

    Returns true if the message caused a Transition.

evaluateState

  • evaluateState(state: State, instance: IInstance, message: any): boolean

findElse

initialise

  • Initialises a state machine instance and/or StateMachine model.

    Passing just the StateMachine model will initialise the model, passing the StateMachine model and instance will initialse the instance and if necessary, the model.

    Parameters

    • model: StateMachine

      The StateMachine model. If autoInitialiseModel is true (or no instance is specified) and the model has changed, the model will be initialised.

    • Optional instance: IInstance

      The optional state machine instance to initialise.

    • Default value autoInitialiseModel: boolean = true

      Defaulting to true, this will cause the model to be initialised prior to initialising the instance if the model has changed.

    Returns void

invoke

  • invoke(actions: Array<Action>, message: any, instance: IInstance, deepHistory?: boolean): void
  • internal

    Parameters

    • actions: Array<Action>
    • message: any
    • instance: IInstance
    • Default value deepHistory: boolean = false

    Returns void

isActive

isComplete

push

  • push(to: Array<Action>, ...actions: Array<Array<Action>>): void

random

  • random(max: number): number
  • The function used for to generate random numbers; may be overriden for testing or other specific purposes.

    Parameters

    • max: number

    Returns number

selectTransition

setConsole

  • setConsole(newConsole: object): void
  • Replace the default console object to implement custom logging.

    Parameters

    • newConsole: object

      An object to send log, warning and error messages to.

      • error: function
        • error(message?: any, ...optionalParams: any[]): void
        • Parameters

          • Optional message: any
          • Rest ...optionalParams: any[]

          Returns void

      • log: function
        • log(message?: any, ...optionalParams: any[]): void
        • Parameters

          • Optional message: any
          • Rest ...optionalParams: any[]

          Returns void

      • warn: function
        • warn(message?: any, ...optionalParams: any[]): void
        • Parameters

          • Optional message: any
          • Rest ...optionalParams: any[]

          Returns void

    Returns void

setInternalTransitionsTriggerCompletion

  • setInternalTransitionsTriggerCompletion(value: boolean): void
  • Change the bahaviour of internal Transitions in respect to trigering completion events for the [[State] they are in.

    Parameters

    • value: boolean

      True for internal Transitions in respect to trigering completion events for the [[State] they are in.

    Returns void

setRandom

  • setRandom(value: function): void
  • Updates the method used to generate random numbers.

    Parameters

    • value: function

      The new method that will be used to generate random numbers.

        • (max: number): number
        • Parameters

          • max: number

          Returns number

    Returns void

traverse

validate

  • Validates a StateMachine model for correctness (see the constraints defined within the UML Superstructure specification).

    Validation warnings and errors are sent to the console.warn and console.error callbacks.

    Parameters

    Returns void

Object literals

console

console: object

The object used for log, warning and error messages.

error

  • error(message?: any, ...optionalParams: any[]): void
  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

log

  • log(message?: any, ...optionalParams: any[]): void
  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

warn

  • warn(message?: any, ...optionalParams: any[]): void
  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

Generated using TypeDoc