Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

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

Hierarchy

Index

Constructors

constructor

  • Creates a new instance of the state class.

    Parameters

    • name: string

      The name of the state.

    • Default value parent: State | Region | undefined = undefined

      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

qualifiedName

qualifiedName: string

The fully qualified name of the element; a composition of the name of element and all its parent elements.

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

  • Adds the types of trigger event that can .

    Parameters

    Returns this

    Returns the state thereby allowing a fluent style state construction.

entry

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

    Parameters

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

      One or callbacks that will be passed the trigger event.

    Returns this

    Returns the state thereby allowing a fluent style state construction.

exit

  • exit(...actions: Array<Consumer<any>>): this
  • Adds a user-defined behaviour to call on state exit.

    Parameters

    • Rest ...actions: Array<Consumer<any>>

      One or callbacks that will be passed the trigger event.

    Returns this

    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

  • 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

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

    Parameters

    • target: Vertex

      The target of the transition.

    • Default value kind: TransitionKind = TransitionKind.External

      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

when

  • Creates a new transition at this vertex with a guard condition.

    Type parameters

    • TTrigger

      The type of the triggering event.

    Parameters

    • guard: Predicate<TTrigger>

      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