public final class Automata extends Object
This class provides various algorithms for manipulating automata. In particular, the following main algorithms are provided:
| Constructor and Description |
|---|
Automata() |
| Modifier and Type | Method and Description |
|---|---|
static Automaton |
extract(Automaton automaton,
int root)
Traverse the automaton rooted at the given state and recursively extract
all reachable states to produce a (potentially smaller) automaton.
|
static void |
extractOnto(int index,
Automaton automaton,
ArrayList<Automaton.State> newNodes) |
static boolean |
isConcrete(Automaton automaton)
Check whether or not an automaton is "concrete".
|
static Automaton |
minimise(Automaton automaton)
This method minimises an automaton by removing equivalent states.
|
static Automaton.State |
remap(Automaton.State node,
int[] rmap)
The remap method takes a node, and mapping from vertices in the old
space to the those in the new space.
|
public static boolean isConcrete(Automaton automaton)
Check whether or not an automaton is "concrete". A concrete automaton cannot have recursive links or non-deterministic states.'
public static Automaton extract(Automaton automaton, int root)
Traverse the automaton rooted at the given state and recursively extract all reachable states to produce a (potentially smaller) automaton.
NOTE: one additional use-case for this method is to effectively "garbage collect" states in the automaton. That is, if you extract from the root of any automaton, you'll get an automaton consisting only of those nodes reachable from the root --- but, no others. Therefore, unreachable nodes (which can arise as a result of other automaton operations) are lost.
automaton - --- automaton to extract fromroot - --- state in automaton to begin extraction frompublic static void extractOnto(int index,
Automaton automaton,
ArrayList<Automaton.State> newNodes)
public static final Automaton minimise(Automaton automaton)
This method minimises an automaton by removing equivalent states. Two
states s1 and s2 are considered equivalent
under the following conditions:
automaton - --- automaton to minimisepublic static Automaton.State remap(Automaton.State node, int[] rmap)
node - --- node to be transposed.rmap - --- mapping from integers in old space to those in new
space.Copyright © 2017. All rights reserved.