DFABuilder

trait DFABuilder[S, T, +D <: (DFA), -K >: DFAelements[S, T] <: Matchable, -Z <: (AutomatonStyle)] extends FABuilder[S, T, D, K, Z] with UnindexedDFA[S, T, Z]

Methods for builders of a deterministic finite automaton.

Type Params
D

Type of DFA constructed by this builder.

K

Builder elements for this builder.

S

Type representing states.

T

Type representing transition labels.

Z

Type of style options for Graphviz export

trait UnindexedDFA[S, T, Z]
trait FABuilder[S, T, D, K, Z]
trait UnindexedFA[S, T, Z]
trait Pretty
trait Graphable[S, T, Z]
trait Builder[K, D[S, T]]
trait Growable[K]
trait Clearable
class Object
trait Matchable
class Any
trait DFABuilder[S, T, D, K, Z]
class DFABuilder[S, T]

Value members

Abstract methods

def removeTransition(s1: S, t: T): Unit

Removes any transition labelled t from s1.

Removes any transition labelled t from s1.

Set the initial state of the DFA.

Set the initial state of the DFA.

Inherited methods

final
def ++=(xs: IterableOnce[K]): DFABuilder[S, T, D, K, Z]
Inherited from
Growable
final
def +=(elem: K): DFABuilder[S, T, D, K, Z]
Inherited from
Growable
def accepts(string: Seq[T]): Boolean

Returns true if this automaton accepts the given string.

Returns true if this automaton accepts the given string.

Inherited from
UnindexedFA
def addAll(xs: IterableOnce[K]): DFABuilder[S, T, D, K, Z]
Inherited from
Growable

Adds a final state to the automaton. This method should have no effect if the state is already a final state, and should subsume addState if the state has not previously been added.

Adds a final state to the automaton. This method should have no effect if the state is already a final state, and should subsume addState if the state has not previously been added.

Inherited from
FABuilder
def addOne(elem: K): DFABuilder[S, T, D, K, Z]
Inherited from
Growable
def addState(s: S): Unit

Adds a state to the automaton. This method should have no effect if the state is already included.

Adds a state to the automaton. This method should have no effect if the state is already included.

Inherited from
FABuilder
def addTransition(s1: S, t: T, s2: S): Unit

Adds a transition labelled t from s1 to s2

Adds a transition labelled t from s1 to s2

Inherited from
FABuilder
def clear(): Unit
Inherited from
Builder

Return the pairs comprising all unlabelled transitions.

Return the pairs comprising all unlabelled transitions.

Inherited from
UnindexedFA

Returns the Set of final states in this automaton.

Returns the Set of final states in this automaton.

Inherited from
UnindexedFA
def foreachETransition(action: (S, S) => Unit { def apply(s1: S, s2: S): Unit; }): Unit

Perform some action for each epsilon transition in the automaton. Note that in many (deterministic) automata, this method is a no-op, but in included for an easy consistency.

Perform some action for each epsilon transition in the automaton. Note that in many (deterministic) automata, this method is a no-op, but in included for an easy consistency.

Inherited from
UnindexedFA
def foreachFinalState(action: S => Unit { def apply(s: S): Unit; }): Unit

Perform some action for each final state in the automaton.

Perform some action for each final state in the automaton.

Inherited from
UnindexedFA
def foreachInitialState(action: S => Unit { def apply(s: S): Unit; }): Unit

Perform some action for each initial state in the automaton.

Perform some action for each initial state in the automaton.

Inherited from
UnindexedFA
def foreachState(action: S => Unit { def apply(s: S): Unit; }): Unit

Perform some action for each state in the automaton.

Perform some action for each state in the automaton.

Inherited from
UnindexedFA
def foreachTransition(action: (S, T, S) => Unit { def apply(s1: S, t: T, s2: S): Unit; }): Unit

Perform some action for each transition in the automaton.

Perform some action for each transition in the automaton.

Inherited from
UnindexedFA
def graphviz(sourceFile: String, outputFile: String)(using options: Z[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: Z[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

Returns the initial state.

Returns the initial state.

Inherited from
UnindexedDFA

Returns the Set of initial states in this automaton.

Returns the Set of initial states in this automaton.

Inherited from
UnindexedFA

Returns whether the given state s is final in this automaton.

Returns whether the given state s is final in this automaton.

Inherited from
UnindexedFA

Returns whether the given state s is initial in this automaton.

Returns whether the given state s is initial in this automaton.

Inherited from
UnindexedFA
def isState(s: S): Boolean

Returns true if s is used as a state

Returns true if s is used as a state

Inherited from
UnindexedFA
Inherited from
Growable

Set of automaton transition labels

Set of automaton transition labels

Inherited from
UnindexedFA
def map[S2, T2](stateMap: S => S2, transitionMap: T => T2): UnindexedFA[S2, T2, Z]

Derive a new isomorphic automaton from this one by applying transforms to the states and transitions. This method does not check that either map is injective: if they are not, then the result may be unpredictable.

Derive a new isomorphic automaton from this one by applying transforms to the states and transitions. This method does not check that either map is injective: if they are not, then the result may be unpredictable.

Inherited from
UnindexedFA
def mapResult[NewTo](f: D[S, T] => NewTo): Builder[K, NewTo]
Inherited from
Builder
def mapStates[S2](stateMap: S => S2): UnindexedFA[S2, T, Z]

Derive a new isomorphic automaton from this one by applying transforms to the states. This method does not check that the stateMap is injective: if it is not, then the result may have separate states which cannot be distinguished.

Derive a new isomorphic automaton from this one by applying transforms to the states. This method does not check that the stateMap is injective: if it is not, then the result may have separate states which cannot be distinguished.

Inherited from
UnindexedFA
def mapTransitions[T2](transitionMap: T => T2): UnindexedFA[S, T2, Z]

Derive a new isomorphic automaton from this one by applying transforms to the transitions. This method does not check that the transitionMap is injective: if it is not, then the result may have separate transitions which cannot be distinguished.

Derive a new isomorphic automaton from this one by applying transforms to the transitions. This method does not check that the transitionMap is injective: if it is not, then the result may have separate transitions which cannot be distinguished.

Inherited from
UnindexedFA
def pretty: Doc
Inherited from
Pretty

Remove a state from the set of final states of the automaton. This method should have no effect if the state is not already a final state, or is not part of the automaton at all.

Remove a state from the set of final states of the automaton. This method should have no effect if the state is not already a final state, or is not part of the automaton at all.

Inherited from
FABuilder
def removeState(s: S): Unit

Remove a state from the automaton. This method should have no effect if the state is not part of the automaton.

Remove a state from the automaton. This method should have no effect if the state is not part of the automaton.

Inherited from
FABuilder
def result(): D[S, T]
Inherited from
Builder
def size: Int

Number of states in the automaton

Number of states in the automaton

Inherited from
UnindexedFA
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

The states themselves

The states themselves

Inherited from
UnindexedFA
def toDOT(using graphvizOptions: Z[S, T]): String

Return the inner lines of a digraph block (or other Graphviz style) to render this object.

Return the inner lines of a digraph block (or other Graphviz style) to render this object.

Inherited from
Graphable
def transition(s: S, t: T): Option[S]

Returns the state, if any, into which the automaton could transition starting from s via a transition labelled t.

Returns the state, if any, into which the automaton could transition starting from s via a transition labelled t.

Inherited from
UnindexedDFA

Return the triples comprising all labelled transitions.

Return the triples comprising all labelled transitions.

Inherited from
UnindexedFA
def transitions(s: S, t: T): Set[S]

Returns the (possibly empty, and in deterministic implementations at most singleton) set of states into which the automaton could transition starting from s via a transition labelled t.

Returns the (possibly empty, and in deterministic implementations at most singleton) set of states into which the automaton could transition starting from s via a transition labelled t.

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*): DFABuilder[S, T, D, K, Z]
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