|
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||
java.lang.Objectdk.brics.automaton.RunAutomaton
public class RunAutomaton
Finite-state automaton with fast run operation.
| 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(InputStream stream)
Retrieves a serialized RunAutomaton from a stream. |
static RunAutomaton |
load(URL url)
Retrieves a serialized RunAutomaton located by a URL. |
AutomatonMatcher |
newMatcher(CharSequence s)
Creates a new automaton matcher for the given input. |
AutomatonMatcher |
newMatcher(CharSequence s,
int startOffset,
int endOffset)
Creates a new automaton matcher for the given input. |
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. |
String |
toString()
Returns a string representation of this automaton. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RunAutomaton(Automaton a)
RunAutomaton from a deterministic
Automaton. Same as RunAutomaton(a, true).
a - an automaton
public 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 usage| Method Detail |
|---|
public char[] getCharIntervals()
public int getInitialState()
public int getSize()
public boolean isAccept(int state)
public static RunAutomaton load(InputStream stream)
throws IOException,
OptionalDataException,
ClassCastException,
ClassNotFoundException,
InvalidClassException
RunAutomaton from a stream.
stream - input stream with serialized automaton
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
public static RunAutomaton load(URL url)
throws IOException,
OptionalDataException,
ClassCastException,
ClassNotFoundException,
InvalidClassException
RunAutomaton located by a URL.
url - URL of serialized automaton
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 foundpublic AutomatonMatcher newMatcher(CharSequence s)
s - the CharSequence to search
public AutomatonMatcher newMatcher(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
public boolean run(String s)
public int run(String s,
int offset)
s - the stringoffset - offset into s where the run starts
public 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 void store(OutputStream stream)
throws IOException
RunAutomaton to the given stream.
stream - output stream for serialized automaton
IOException - if input/output related exception occurspublic String toString()
toString in class Object
|
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||