class Pegasus::Automata::UniqueAutomaton(V, T)

Overview

Another generic automaton. Since many automatons created by pegasus do not like two nodes with the same data, this class overries the #state_for function to return an existing state with the given data if such a state exists.

Direct Known Subclasses

Defined in:

pegasus/automaton.cr

Constructors

Instance Method Summary

Instance methods inherited from class Pegasus::Automata::Automaton(V, T)

last_id : Int64 last_id, start : State(V, T) | Nil start, start=(start : State(V, T) | Nil) start=, state_for(*, data : V) state_for, states : Set(State(V, T)) states

Constructor methods inherited from class Pegasus::Automata::Automaton(V, T)

new new

Constructor Detail

def self.new #

Creates a new UniqueAutomaton.


[View source]

Instance Method Detail

def state_for(*, data : V) #

Creates a new state for the given data, or returns an existing state with the data if one exists.


[View source]