Options
All
  • Public
  • Public/Protected
  • All
Menu

A state is a situation in the lifecycle of the state machine that is stable between events.

Hierarchy

  • Vertex
    • State

Index

Constructors

constructor

  • Creates a new instance of the state class.

    Parameters

    • name: string

      The name of the state.

    • parent: undefined | Region | State = ...

      The parent region of the state; note that another state can also be used, in which case the default region of the state will become this states parent. If parent is left undefined, then this state is the root of the state machine hierarchy.

    Returns State

Properties

Readonly name

name: string

Readonly parent

parent: undefined | Region

The parent region of the vertex.

Methods

accept

  • Accepts a visitor and calls visitor.visitStateHead method, cascades to child regions then calls the visitor.visitStateTail.

    Parameters

    • visitor: Visitor

      The visitor to call back.

    Returns void

defer

  • defer(...type: Constructor<any>[]): State
  • Adds the types of trigger event that can .

    Parameters

    • Rest ...type: Constructor<any>[]

    Returns State

    Returns the state thereby allowing a fluent style state construction.

entry

  • entry(...actions: Behaviour<any>[]): State
  • Adds a user-defined behaviour to call on state entry.

    Parameters

    • Rest ...actions: Behaviour<any>[]

      One or callbacks that will be passed the trigger event.

    Returns State

    Returns the state thereby allowing a fluent style state construction.

exit

  • exit(...actions: Behaviour<any>[]): State
  • Adds a user-defined behaviour to call on state exit.

    Parameters

    • Rest ...actions: Behaviour<any>[]

      One or callbacks that will be passed the trigger event.

    Returns State

    Returns the state thereby allowing a fluent style state construction.

isComposite

  • isComposite(): boolean
  • Tests a state to see if it is a composite state, one with one or more child regions.

    Returns boolean

    Returns true if the state is a composite state.

isFinal

  • isFinal(): boolean
  • Tests a state to see if it is a final state, one without outgoing transitions.

    Returns boolean

    Returns true if the state is a final state.

isOrthogonal

  • isOrthogonal(): boolean
  • Tests a state to see if it is an orthogonal state, one with two or more child regions.

    Returns boolean

    Returns true if the state is an orthogonal state.

isSimple

  • isSimple(): boolean
  • Tests a state to see if it is a simple state, one without and child regions.

    Returns boolean

    Returns true if the state is a simple state.

on

  • on<TTrigger>(type: Constructor<TTrigger>): Transition<TTrigger>
  • Creates a new transition at this vertex triggered by an event of a specific type.

    Type parameters

    • TTrigger

      The type of the triggering event; note that this can be derived from the type parameter.

    Parameters

    • type: Constructor<TTrigger>

      The type (class name) of the triggering event.

    Returns Transition<TTrigger>

    Returns a new typed transition. A typed transition being one whose guard condition and behaviour will accept a parameter of the same type specified.

to

  • Creates a new transition from this vertex to the target vertex.

    Type parameters

    • TTrigger = any

      The type of the triggering event that the guard will evaluate.

    Parameters

    • target: Vertex

      The target of the transition.

    • kind: TransitionKind = ...

      The kind of the transition, specifying its behaviour.

    Returns Transition<any>

    Returns a new transition; if TTrigger is specified, a typed transition will be returned.

toString

  • toString(): string
  • Returns the element in string form; the fully qualified name of the element.

    Returns string

when

  • when<TTrigger>(guard: Function<TTrigger, boolean>): Transition<TTrigger>
  • Creates a new transition at this vertex with a guard condition.

    Type parameters

    • TTrigger = any

      The type of the triggering event.

    Parameters

    • guard: Function<TTrigger, boolean>

      The guard condition to determine if the transition should be traversed.

    Returns Transition<TTrigger>

    Returns a new transition; if TTrigger is specified, a typed transition will be returned.

Generated using TypeDoc