Interface FABuilder<S, T>

An FA builder has the responsibility of constructing a finite automaton.

The constructed FA is always owned by the builder.

Type Parameters

  • S

    The type of a state.

  • T

    The transition type of the values linking states.

Hierarchy

Implemented by

Properties

createNode: (() => S)

Type declaration

    • (): S
    • Creates a new state.

      Returns S

      Throws

      TooManyNodesError May be thrown if the number of created nodes exceeds some limit.

initial: S

The initial state of the FA.

isFinal: ((state: S) => boolean)

Type declaration

    • (state: S): boolean
    • Returns whether the given state is a final state.

      This operation is assumed to be semantically equivalent to isFinal.

      Parameters

      • state: S

      Returns boolean

linkNodes: ((from: S, to: S, transition: T) => void)

Type declaration

    • (from: S, to: S, transition: T): void
    • Links to the two given states using the given transition.

      Calling this operations more than once for the given from and to states is not guaranteed to succeed.

      Parameters

      • from: S
      • to: S
      • transition: T

      Returns void

makeFinal: ((state: S) => void)

Type declaration

    • (state: S): void
    • Makes the given state behave like a final state of this FA.

      This does not necessarily mean that the given state will be a final state. I.e. calling makeFinal(s) does not necessitate that isFinal(s) is true.

      The implementation has to guarantee that calling this method for the same state more than once is allowed.

      Parameters

      • state: S

      Returns void