public class RunAutomaton
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
RunAutomaton(Automaton a)
Constructs a new
RunAutomaton from a deterministic
Automaton. |
RunAutomaton(Automaton a,
boolean tableize)
Constructs a new
RunAutomaton from a deterministic
Automaton. |
| Modifier and Type | Method and Description |
|---|---|
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(java.io.InputStream stream)
Retrieves a serialized
RunAutomaton from a stream. |
static RunAutomaton |
load(java.net.URL url)
Retrieves a serialized
RunAutomaton located by a URL. |
AutomatonMatcher |
newMatcher(java.lang.CharSequence s)
Creates a new automaton matcher for the given input.
|
AutomatonMatcher |
newMatcher(java.lang.CharSequence s,
int startOffset,
int endOffset)
Creates a new automaton matcher for the given input.
|
boolean |
run(java.lang.String s)
Returns true if the given string is accepted by this automaton.
|
int |
run(java.lang.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(java.io.OutputStream stream)
Writes this
RunAutomaton to the given stream. |
java.lang.String |
toString()
Returns a string representation of this automaton.
|
public RunAutomaton(Automaton a)
RunAutomaton from a deterministic
Automaton. Same as RunAutomaton(a, true).a - an automatonpublic RunAutomaton(Automaton a, boolean tableize)
RunAutomaton from a deterministic
Automaton. If the given automaton is not deterministic,
it is determinized first.a - an automatontableize - if true, a transition table is created which makes the run
method faster in return of a higher memory usagepublic java.lang.String toString()
toString in class java.lang.Objectpublic int getSize()
public boolean isAccept(int state)
public int getInitialState()
public char[] getCharIntervals()
public static RunAutomaton load(java.net.URL url) throws java.io.IOException, java.io.OptionalDataException, java.lang.ClassCastException, java.lang.ClassNotFoundException, java.io.InvalidClassException
RunAutomaton located by a URL.url - URL of serialized automatonjava.io.IOException - if input/output related exception occursjava.io.OptionalDataException - if the data is not a serialized objectjava.io.InvalidClassException - if the class serial number does not matchjava.lang.ClassCastException - if the data is not a serialized RunAutomatonjava.lang.ClassNotFoundException - if the class of the serialized object cannot be foundpublic static RunAutomaton load(java.io.InputStream stream) throws java.io.IOException, java.io.OptionalDataException, java.lang.ClassCastException, java.lang.ClassNotFoundException, java.io.InvalidClassException
RunAutomaton from a stream.stream - input stream with serialized automatonjava.io.IOException - if input/output related exception occursjava.io.OptionalDataException - if the data is not a serialized objectjava.io.InvalidClassException - if the class serial number does not matchjava.lang.ClassCastException - if the data is not a serialized RunAutomatonjava.lang.ClassNotFoundException - if the class of the serialized object cannot be foundpublic void store(java.io.OutputStream stream)
throws java.io.IOException
RunAutomaton to the given stream.stream - output stream for serialized automatonjava.io.IOException - if input/output related exception occurspublic int step(int state,
char c)
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.)public boolean run(java.lang.String s)
public int run(java.lang.String s,
int offset)
s - the stringoffset - offset into s where the run startspublic AutomatonMatcher newMatcher(java.lang.CharSequence s)
s - the CharSequence to searchpublic AutomatonMatcher newMatcher(java.lang.CharSequence s, int startOffset, int endOffset)
s - the CharSequence to searchstartOffset - the starting offset of the given character sequenceendOffset - the ending offset of the given character sequence