Constructor and Description |
---|
Builder()
Default constructor, pre-allocating for 16 states and transitions.
|
Builder(int numStates,
int numTransitions)
Constructor which creates a builder with enough space for the given
number of states and transitions.
|
Modifier and Type | Method and Description |
---|---|
void |
addEpsilon(int source,
int dest)
Add a [virtual] epsilon transition between source and dest.
|
void |
addTransition(int source,
int dest,
int label)
Add a new transition with min = max = label.
|
void |
addTransition(int source,
int dest,
int min,
int max)
Add a new transition with the specified source, dest, min, max.
|
void |
copy(Automaton other)
Copies over all states/transitions from other.
|
void |
copyStates(Automaton other)
Copies over all states from other.
|
int |
createState()
Create a new state.
|
Automaton |
finish()
Compiles all added states and transitions into a new
Automaton
and returns it. |
int |
getNumStates()
How many states this automaton has.
|
boolean |
isAccept(int state)
Returns true if this state is an accept state.
|
void |
setAccept(int state,
boolean accept)
Set or clear this state as an accept state.
|
public Builder()
public Builder(int numStates, int numTransitions)
numStates
- Number of states.numTransitions
- Number of transitions.public void addTransition(int source, int dest, int label)
public void addTransition(int source, int dest, int min, int max)
public void addEpsilon(int source, int dest)
public Automaton finish()
Automaton
and returns it.public int createState()
public void setAccept(int state, boolean accept)
public boolean isAccept(int state)
public int getNumStates()
public void copy(Automaton other)
public void copyStates(Automaton other)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.