NFABuilder

trait NFABuilder[S, T, G <: (Set), +D <: (DFA), +N <: (NFA), -K >: NFAelements[S, T] <: Matchable, -NZ <: (AutomatonStyle), -DZ <: (AutomatonStyle)]() extends NFABuilder[S, T, G, D, N, K, NZ, DZ] with FABuilder[S, T, N, K, NZ]

Implementation of NFABuilder using `HashMap`s and `HashSet`s.

Type Params
S

The type of all states of the automaton

T

The type of labels on (non-epsilon) transitions of the automaton

Constructor

Returns a builder holding an initially empty automaton

trait FABuilder[S, T, N, K, NZ]
trait StatesMixin[S, T]
trait UnindexedFA[S, T, NZ]
trait NFABuilder[S, T, G, D, N, K, NZ, DZ]
trait UnindexedNFA[S, T, G, D, NZ, DZ]
trait FABuilder[S, T, N, K, NZ]
trait UnindexedFA[S, T, NZ]
trait Pretty
trait Graphable[S, T, NZ]
trait Builder[K, N[S, T]]
trait Growable[K]
trait Clearable
class Object
trait Matchable
class Any

Value members

Abstract methods

protected
def assembleNFA(statesSeq: IndexedSeq[S], initials: Set[Int], finals: Set[Int], transitionsSeq: IndexedSeq[T], labelsArray: Array[Array[Set[Int]]], epsilonsArray: Array[Set[Int]]): N[S, T]
protected
def derivedNFA[S0, T0](stateSeq: IndexedSeq[S0], transitionsSeq: IndexedSeq[T0], initials: Set[Int], finalStateIndices: Set[Int], labelsArray: Array[Array[Set[Int]]], epsilonsArray: Array[Set[Int]]): N[S0, T0]

Internal method for instantiating a DFA of the appropriate runtime type which may not have the same type components as this DFA.

Internal method for instantiating a DFA of the appropriate runtime type which may not have the same type components as this DFA.

Concrete methods

def accepts(string: Seq[T]): Boolean
def addETransition(s1: S, s2: S): Unit
override
def addOne(builder: K): NFABuilder[S, T, G, D, N, K, NZ, DZ]

Helper method for the scala.collection.mutable.Builder implementation.

Helper method for the scala.collection.mutable.Builder implementation.

Definition Classes
def addTransition(s1: S, t: T, s2: S): Unit
protected
override
Definition Classes
def eTransitions(s: S): Set[S]
def foreachETransition(action: (S, S) => Unit): Unit
override
def map[S2, T2](stateMap: S => S2, transitionMap: T => T2): NFA[S2, T2, G, D, NZ, DZ]
Definition Classes
override
def mapStates[S2](stateMap: S => S2): NFA[S2, T, G, D, NZ, DZ]
Definition Classes
override
def mapTransitions[T2](transitionMap: T => T2): NFA[S, T2, G, D, NZ, DZ]
Definition Classes
override protected
def prettyHeader: Doc
Definition Classes
def removeETransition(s1: S, s2: S): Unit
def removeTransition(s1: S, t: T, s2: S): Unit
def result(): N[S, T]

Creates an immutable NFA corresponding to the automaton described to this builder. This method creates elements of the internal state of the NFA, and passes them to the abstract method assembleNFA: the actual definition of assembleNFA is in the concrete classes (of package org.maraist.fa) implementing this trait.

Creates an immutable NFA corresponding to the automaton described to this builder. This method creates elements of the internal state of the NFA, and passes them to the abstract method assembleNFA: the actual definition of assembleNFA is in the concrete classes (of package org.maraist.fa) implementing this trait.

override
def toDFA: D[G[S], T]
Definition Classes
def transitions(s: S, t: T): Set[S]

Inherited methods

final
def ++=(xs: IterableOnce[K]): NFABuilder[S, T, G, D, N, K, NZ, DZ]
Inherited from
Growable
final
def +=(elem: K): NFABuilder[S, T, G, D, N, K, NZ, DZ]
Inherited from
Growable
def addAll(xs: IterableOnce[K]): NFABuilder[S, T, G, D, N, K, NZ, DZ]
Inherited from
Growable
override
Definition Classes
Inherited from
FABuilder
def addState(s: S): Unit
Inherited from
StatesMixin
protected
def afterStatePlot(sb: StringBuilder, style: NZ[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int]): Unit
Inherited from
UnindexedFA
protected
def assemblePrettyTransition(before: Doc, arrow: Doc, after: Doc): Doc
Inherited from
UnindexedFA
protected
Inherited from
UnindexedFA
override
def clear(): Unit

Clear this builder. When overriding this method, it is important to call super.clear().

Clear this builder. When overriding this method, it is important to call super.clear().

Definition Classes
Inherited from
FABuilder
def dump(out: PrintStream): Unit
Inherited from
UnindexedFA
protected
def edgeText(style: NZ[S, T], si0: Int, s0: S, si1: Int, s1: S): String
Inherited from
UnindexedFA
protected
def edgeText(style: NZ[S, T], si0: Int, s0: S, ti0: Int, t: T, si1: Int, s1: S): String
Inherited from
UnindexedFA
override
Definition Classes
Inherited from
FABuilder
protected
Inherited from
UnindexedFA
override
def foreachFinalState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachInitialState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachState(action: S => Unit { def apply(s: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
override
def foreachTransition(action: (S, T, S) => Unit { def apply(s1: S, t: T, s2: S): Unit; }): Unit
Definition Classes
Inherited from
UnindexedFA
def graphviz(sourceFile: String, outputFile: String)(using options: NZ[S, T]): Unit

Use Graphviz to render this object as specified.

Use Graphviz to render this object as specified.

Inherited from
Graphable
def graphviz(fileRoot: String)(using options: NZ[S, T]): Unit

Use Graphviz to render this object (in the default format) to the given file.

Use Graphviz to render this object (in the default format) to the given file.

Inherited from
Graphable
protected
def initPlot(sb: StringBuilder, states: Int, labels: Int): Unit
Inherited from
UnindexedFA
protected
def internalsToDOT(stateList: IndexedSeq[S], stateMap: Map[S, Int], theLabels: IndexedSeq[T], sb: StringBuilder)(using style: NZ[S, T]): Unit

Internal routine used by [[#toDOT]]. Subclesses may override, but still call super.internalsToDOT, to extend the Graphviz representation of a DFA.

Internal routine used by [[#toDOT]]. Subclesses may override, but still call super.internalsToDOT, to extend the Graphviz representation of a DFA.

Inherited from
UnindexedFA
override
Definition Classes
Inherited from
FABuilder
def isState(s: S): Boolean
Inherited from
StatesMixin
Inherited from
Growable
def mapResult[NewTo](f: N[S, T] => NewTo): Builder[K, NewTo]
Inherited from
Builder
protected
def plotInitialStateMarker(sb: StringBuilder, style: NZ[S, T], s: S, idx: Int): Unit

Add decorations for an initial state.

Add decorations for an initial state.

Inherited from
UnindexedFA
protected
def plotPresentEdge(sb: StringBuilder, style: NZ[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int], si0: Int, s0: S, si1: Int, s1: S): Unit
Inherited from
UnindexedFA
protected
def plotPresentEdge(sb: StringBuilder, style: NZ[S, T], stateList: IndexedSeq[S], stateMap: Map[S, Int], si0: Int, s0: S, ti0: Int, t: T, si1: Int, s1: S): Unit
Inherited from
UnindexedFA
protected
def plotState(sb: StringBuilder, style: NZ[S, T], si: Int, s: S, isInitial: Boolean, isFinal: Boolean): Unit
Inherited from
UnindexedFA
protected
def plotTransitions(stateList: IndexedSeq[S], stateMap: Map[S, Int], theLabels: IndexedSeq[T], sb: StringBuilder, style: NZ[S, T]): Unit
Inherited from
UnindexedFA
def pretty: Doc
Inherited from
UnindexedFA
protected
def prettyETransition(src: S, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyETransitionArrow(src: S, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyFooter: Doc
Inherited from
UnindexedFA
protected
def prettyState(s: S): Doc
Inherited from
UnindexedFA
protected
def prettyStateInTransition(state: S): Doc
Inherited from
UnindexedFA
protected
def prettyStateLeader(s: S): Doc
Inherited from
UnindexedFA
protected
def prettyStates: Doc
Inherited from
UnindexedFA
protected
def prettyTransition(src: S, label: T, dest: S): Doc
Inherited from
UnindexedFA
protected
def prettyTransitionArrow(src: S, label: T, dest: S): Doc
Inherited from
UnindexedFA
protected
Inherited from
UnindexedFA
override
Definition Classes
Inherited from
FABuilder
def removeState(s: S): Unit
Inherited from
StatesMixin
def size: Int
Inherited from
StatesMixin
final
def sizeHint(coll: IterableOnce[_], delta: Int): Unit
Inherited from
Builder
def sizeHint(size: Int): Unit
Inherited from
Builder
final
def sizeHintBounded(size: Int, boundingColl: Iterable[_]): Unit
Inherited from
Builder
def states: Set[S]
Inherited from
StatesMixin
override
def toDOT(using NZ[S, T]): String
Definition Classes
UnindexedFA -> Graphable
Inherited from
UnindexedFA
override
Definition Classes
Inherited from
UnindexedFA

Deprecated and Inherited methods

@inline @deprecated(message = "Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated", since = "2.13.0")
final
def +=(elem1: K, elem2: K, elems: K*): NFABuilder[S, T, G, D, N, K, NZ, DZ]
Deprecated
[Since version 2.13.0] Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated
Inherited from
Growable

Concrete fields

protected
protected
protected

Inherited fields

protected

Storage for all state objects

Storage for all state objects

Inherited from
StatesMixin
protected

Storage for all final state objects.

Storage for all final state objects.

Inherited from
FABuilder