Interface FAIterator<S, O>

A graph iterator for all states of an FA with final states.

Type Parameters

  • S

    The type of a state in the FA to iterate.

  • O = Iterable<S>

    The type of the value each state maps to.

Hierarchy

  • FAIterator

Properties

getOut: ((state: S) => O)

Type declaration

    • (state: S): O
    • Returns the value a state maps to.

      Callers of this function are allowed to call the function without a this argument.

      Parameters

      • state: S

      Returns O

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 function is guaranteed to be deterministic during the time the iterator is used. It is also guaranteed to be sufficiently fast, usually O(1) can be assumed.

      Callers of this function are allowed to call the function without a this argument.

      Parameters

      • state: S

      Returns boolean

stableOut?: boolean

Whether the getOut function is stableOut during the lifetime of the iterator.

Stable means that if getOut gets called for the same state more than once, it will always return the same value.

The sameness of states is defined by the key equality of the Map class.

The sameness of returned values is not defined by this interface and depends of the iterator.

I.e. a stable getOut function may return new collections/iterators on subsequent invocations as long as the collections/iterators are considered equal (e.g. equal could be defined as "same elements") by the consumer of the iterator.

Default

false