DFA

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

A representation of a deterministic finite automaton (DFA).

Constructors

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

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

True, if the DFA is currently in an accepting state.

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 override 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(): DFA

Create a shallow copy

Link copied to clipboard
open override fun deepCopy(): DFA

Creates a deep copy the DFA 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

Associates the start state with a cpgNode.

Link copied to clipboard

Checks if the transition with operator op is possible from the current state of the FSM. If so, it updates the state of the FSM and returns true. If no transition is possible, returns false. Collects the old state, the edge and the cpgNode in the executionTrace in a Trace and appends it to the executionTrace

Link copied to clipboard
Link copied to clipboard

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