public final class Automaton extends Object
A finite-state automaton for representing Whiley types. This is a machine for accepting matching inputs of a given language. An automaton is a directed graph whose nodes and edges are referred to as states and transitions. Each state has a "kind" which determines how the state behaves on given inputs. For example, a state with "OR" kind might accept an input if either of its children does; in contrast, and state of "AND" kind might accept an input only if all its children does.
The organisation of children is done according to two approaches: deterministic and non-deterministic. In the deterministic approach, the ordering of children is important; in the non-deterministic approach, the ordering of children is not important. A flag is used to indicate whether a state is deterministic or not.
Aside from having a particular kind, each state may also have supplementary material. This can be used, for example, to effectively provide labelled transitions. Another use of this might be to store a given string which must be matched.
NOTE: In the internal representation of automata, leaf states may be not be represented as actual nodes. This will occur if the leaf node does not include any supplementary data, and is primarily for space and performance optimisation. In such case, the node is represented as a child node using a negative index.
| Modifier and Type | Class and Description |
|---|---|
static class |
Automaton.State
Represents a state in an automaton.
|
| Modifier and Type | Field and Description |
|---|---|
static int[] |
NOCHILDREN
The following constant is used simply to prevent unnecessary memory
allocations.
|
Automaton.State[] |
states |
| Constructor and Description |
|---|
Automaton(Automaton.State... states) |
Automaton(Automaton automaton) |
Automaton(List<Automaton.State> states) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
This method compares two compound types to test whether they are
identical.
|
int |
hashCode()
Determine the hashCode of a type.
|
int |
size() |
String |
toString() |
public Automaton.State[] states
public static final int[] NOCHILDREN
public Automaton(Automaton.State... states)
public Automaton(List<Automaton.State> states)
public Automaton(Automaton automaton)
public int size()
public int hashCode()
public boolean equals(Object o)
isomorphic(t1,t2) method.Copyright © 2017. All rights reserved.