dk.brics.automaton
public class RunAutomaton extends Object implements Serializable
Constructor Summary | |
---|---|
RunAutomaton(Automaton a)
Constructs a new RunAutomaton from a deterministic
Automaton . | |
RunAutomaton(Automaton a, boolean tableize)
Constructs a new RunAutomaton from a deterministic
Automaton . |
Method Summary | |
---|---|
char[] | getCharIntervals()
Returns array of character class interval start points. |
int | getInitialState()
Returns initial state. |
int | getSize()
Returns number of states in automaton. |
boolean | isAccept(int state)
Returns acceptance status for given state. |
static RunAutomaton | load(URL url)
Retrieves a serialized RunAutomaton located by a URL. |
static RunAutomaton | load(InputStream stream)
Retrieves a serialized RunAutomaton from a stream. |
boolean | run(String s)
Returns true if the given string is accepted by this automaton. |
int | run(String s, int offset)
Returns the length of the longest accepted run of the given string
starting at the given offset. |
int | step(int state, char c)
Returns the state obtained by reading the given char from the given
state. |
void | store(OutputStream stream)
Writes this RunAutomaton to the given stream. |
RunAutomaton
from a deterministic
Automaton
. Same as RunAutomaton(a, true)
.Parameters: a an automaton
RunAutomaton
from a deterministic
Automaton
. If the given automaton is not deterministic,
it is determinized first.Parameters: a an automaton tableize if true, a transition table is created which makes the run
method faster in return of a higher memory usage
RunAutomaton
located by a URL.Parameters: url URL of serialized automaton
Throws: IOException if input/output related exception occurs OptionalDataException if the data is not a serialized object InvalidClassException if the class serial number does not match ClassCastException if the data is not a serialized RunAutomaton
ClassNotFoundException if the class of the serialized object cannot be found
RunAutomaton
from a stream.Parameters: stream input stream with serialized automaton
Throws: IOException if input/output related exception occurs OptionalDataException if the data is not a serialized object InvalidClassException if the class serial number does not match ClassCastException if the data is not a serialized RunAutomaton
ClassNotFoundException if the class of the serialized object cannot be found
Parameters: s the string offset offset into s
where the run starts
Returns: length of the longest accepted run, -1 if no run is accepted
Automaton
had no dead states, -1 is returned here if and
only if a dead state is entered in an equivalent automaton with a total
transition function.)RunAutomaton
to the given stream.Parameters: stream output stream for serialized automaton
Throws: IOException if input/output related exception occurs