NFA

class NFA(states: Set<State> = setOf()) : FSM

A representation of a non-deterministic finite automaton (NFA).

Constructors

Link copied to clipboard
constructor(states: Set<State> = setOf())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun addEdge(from: State, edge: Edge)

Creates an edge between two nodes with a given label (operator and optional base).

Link copied to clipboard
fun addState(isStart: Boolean = false, isAcceptingState: Boolean = false): State

Generates a new state and adds it to this FSM.

Link copied to clipboard
fun changeStateProperty(state: State, name: Int? = null, isStart: Boolean? = null, isAcceptingState: Boolean? = null): Boolean

Safely change a property of a state contained in this FSM. Before changing the property, this method makes sure that e.g., no other start state exists or that no other state already has the suggested name.

Link copied to clipboard
fun checkedChangeStateProperty(state: State, name: Int? = null, isStart: Boolean? = null, isAcceptingState: Boolean? = null)

Same as changeStateProperty but throws an IllegalStateException if the property could not be changed.

Link copied to clipboard
open fun checkEdge(state: State, edge: Edge)

This function is set as State.edgeCheck inside addState. In case the edge must not be added to the state, this function must throw an exception.

Link copied to clipboard
open override fun copy(): NFA

Create a shallow copy

Link copied to clipboard
open fun deepCopy(): FSM

Creates a deep copy of this FSM to enable multiple independent branches of execution.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks whether the given object is an FSM and whether it accepts the same language as this FSM

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
fun toDfa(): DFA

Compute the ε-closure for this ε-NFA and then use the powerset construction algorithm ( example) to convert it to a DFA

Link copied to clipboard

Generates the string representing this FSM in DOT format. This allows a simple visualization of the resulting automaton.