NFA

class NFA[S, T](val stateSeq: IndexedSeq[S], val transitionsSeq: IndexedSeq[T], val initialStateIndices: Set[Int], val finalStateIndices: Set[Int], val epsilonsArray: Array[Set[Int]], val transitionsArray: Array[Array[Set[Int]]]) extends NFA[S, T, Set, DFA, AutomatonStyle, AutomatonStyle]

Methods provided by nondeterministic finite automata (NFAs).

Trait specifying methods provided by all NFAs, and providing default implementations for derivations from the core methods.

Type Params
S

The type of all states of the automaton.

T

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

Companion
object

Value members

Concrete methods

override
def derivedNFA[S0, T0](stateSeq: IndexedSeq[S0], transitionsSeq: IndexedSeq[T0], transitionsArray: Array[Array[Set[Int]]], epsilonsArray: Array[Set[Int]], finalStateIndices: Set[Int], initialStateIndices: Set[Int]): NFA[S0, T0]
Definition Classes

Inherited methods

override
def accepts(string: Seq[T]): Boolean

Returns true if this automaton accepts the given string. The default implementation is to convert the NFA to a DFA, and check acceptance there. This is not necessarily good.

Returns true if this automaton accepts the given string. The default implementation is to convert the NFA to a DFA, and check acceptance there. This is not necessarily good.

Definition Classes
Inherited from
NFA
protected
def afterStatePlot(sb: StringBuilder, style: AutomatonStyle[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
override protected
Definition Classes
Inherited from
FA
protected
def dfaEdgeHook(dfaSrcIdx: Int, nfaSrcIndices: Set[Int], ti: Int, t: T, nfaDestIndices: Set[Int], dfaDestIdx: Int, tracker: IndexSetsTracker): Unit

This method serves as a hook into the Rabin-Scott implementation for variation by extensions of the classical NFA. Does nothing by default, but can be overridden in subclasses. This method is called at the point where an entry is added to the (under construction) array of DFA transitions.

This method serves as a hook into the Rabin-Scott implementation for variation by extensions of the classical NFA. Does nothing by default, but can be overridden in subclasses. This method is called at the point where an entry is added to the (under construction) array of DFA transitions.

Inherited from
NFA
def dump(out: PrintStream): Unit
Inherited from
UnindexedFA
override
Definition Classes
NFA -> NFA
Inherited from
NFA
override
Definition Classes
Inherited from
NFA
override
def eTransitions(s: S): Set[S]
Definition Classes
Inherited from
NFA
protected
def edgeText(style: AutomatonStyle[S, T], si0: Int, s0: S, si1: Int, s1: S): String
Inherited from
UnindexedFA
protected
def edgeText(style: AutomatonStyle[S, T], si0: Int, s0: S, ti0: Int, t: T, si1: Int, s1: S): String
Inherited from
UnindexedFA
protected
Inherited from
NFA
protected
Inherited from
NFA
override
Definition Classes
Inherited from
NFA
protected
Inherited from
UnindexedFA
override
def foreachETransition(action: (S, S) => Unit { def apply(s1: S, s2: S): Unit; }): Unit
Definition Classes
Inherited from
NFA
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
override
Definition Classes
FA -> FA
Inherited from
FA
override
Definition Classes
FA -> FA
Inherited from
FA
def graphviz(sourceFile: String, outputFile: String)(using options: AutomatonStyle[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: AutomatonStyle[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
override
Definition Classes
Inherited from
NFA
protected
def internalsToDOT(stateList: IndexedSeq[S], stateMap: Map[S, Int], theLabels: IndexedSeq[T], sb: StringBuilder)(using style: AutomatonStyle[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
NFA
override
Definition Classes
Inherited from
NFA
override
def isState(s: S): Boolean
Definition Classes
Inherited from
FA
override
def label(i: Int): T
Definition Classes
FA -> FA
Inherited from
FA
override
Definition Classes
Inherited from
FA
override
def map[S2, T2](stateMap: S => S2, transitionMap: T => T2): NFA[S2, T2, Set, DFA, AutomatonStyle, AutomatonStyle]
Definition Classes
Inherited from
NFA
override
def mapStates[S2](stateMap: S => S2): NFA[S2, T, Set, DFA, AutomatonStyle, AutomatonStyle]
Definition Classes
Inherited from
NFA
override
def mapTransitions[T2](transitionMap: T => T2): NFA[S, T2, Set, DFA, AutomatonStyle, AutomatonStyle]
Definition Classes
Inherited from
NFA
protected

Add decorations for an initial state.

Add decorations for an initial state.

Inherited from
UnindexedFA
protected
def plotPresentEdge(sb: StringBuilder, style: AutomatonStyle[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: AutomatonStyle[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: AutomatonStyle[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: AutomatonStyle[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
override protected
def prettyHeader: Doc
Definition Classes
Inherited from
NFA
protected
def prettyState(s: S): Doc
Inherited from
UnindexedFA
override protected
def prettyStateInTransition(state: S): Doc
Definition Classes
Inherited from
FA
override protected
def prettyStateLeader(s: S): Doc
Definition Classes
Inherited from
FA
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
Inherited from
NFA
override
def size: Int
Definition Classes
Inherited from
FA
override
def state(i: Int): S
Definition Classes
FA -> FA
Inherited from
FA
override
Definition Classes
Inherited from
FA
override
def toDFA: DFA[Set[S], T]
Definition Classes
Inherited from
NFA
override
def toDOT(using AutomatonStyle[S, T]): String
Definition Classes
FA -> UnindexedFA -> Graphable
Inherited from
FA
override
Definition Classes
NFA -> Any
Inherited from
NFA
override
def transitionIndices(s: S, t: T): Set[Int]
Definition Classes
NFA -> NFA
Inherited from
NFA
override
Definition Classes
Inherited from
UnindexedFA
override
def transitions(s: S, t: T): Set[S]
Definition Classes
Inherited from
NFA

Concrete fields

override
override
override
override
override

Inherited fields

override
val indexOf: Map[S, Int]
Inherited from
FA
override
Inherited from
FA