Builder

class Builder @JvmOverloads constructor(numStates: Int = 16, numTransitions: Int = 16)

Records new states and transitions and then .finish creates the Automaton. Use this when you cannot create the Automaton directly because it's too restrictive to have to add all transitions leaving each state at once.

Constructors

Link copied to clipboard
constructor(numStates: Int = 16, numTransitions: Int = 16)

Properties

Link copied to clipboard

How many states this automaton has.

Functions

Link copied to clipboard
fun addEpsilon(source: Int, dest: Int)

Add a virtual epsilon transition between source and dest. Dest state must already have all transitions added because this method simply copies those same transitions over to source.

Link copied to clipboard
fun addTransition(source: Int, dest: Int, label: Int)

Add a new transition with min = max = label.

fun addTransition(source: Int, dest: Int, min: Int, max: Int)

Add a new transition with the specified source, dest, min, max.

Link copied to clipboard
fun copy(other: Automaton)

Copies over all states/transitions from other.

Link copied to clipboard
fun copyStates(other: Automaton)

Copies over all states from other.

Link copied to clipboard

Create a new state.

Link copied to clipboard

Compiles all added states and transitions into a new Automaton and returns it.

Link copied to clipboard
fun isAccept(state: Int): Boolean

Returns true if this state is an accept state.

Link copied to clipboard
fun setAccept(state: Int, accept: Boolean)

Set or clear this state as an accept state.