public class State extends Object implements Comparable<State>
Modifier and Type | Field and Description |
---|---|
int |
numTransitions |
Transition[] |
transitionsArray |
Constructor and Description |
---|
State()
Constructs a new state.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransition(Transition t)
Adds an outgoing transition.
|
int |
compareTo(State s)
Compares this object with the specified object for order.
|
int |
getNumber()
Return this state's number.
|
Iterable<Transition> |
getTransitions()
Returns the set of outgoing transitions.
|
int |
hashCode() |
boolean |
isAccept()
Returns acceptance status.
|
int |
numTransitions() |
void |
reduce()
Reduces this state.
|
void |
setAccept(boolean accept)
Sets acceptance for this state.
|
void |
setTransitions(Transition[] transitions) |
void |
sortTransitions(Comparator<Transition> comparator)
Sorts transitions array in-place.
|
State |
step(int c)
Performs lookup in transitions, assuming determinism.
|
void |
step(int c,
Collection<State> dest)
Performs lookup in transitions, allowing nondeterminism.
|
String |
toString()
Returns string describing this state.
|
void |
trimTransitionsArray()
Downsizes transitionArray to numTransitions
|
public Transition[] transitionsArray
public int numTransitions
public State()
public Iterable<Transition> getTransitions()
public int numTransitions()
public void setTransitions(Transition[] transitions)
public void addTransition(Transition t)
t
- transitionpublic void setAccept(boolean accept)
accept
- if true, this state is an accept statepublic boolean isAccept()
public State step(int c)
c
- codepoint to look upstep(int, Collection)
public void step(int c, Collection<State> dest)
c
- codepoint to look updest
- collection where destination states are storedstep(int)
public void trimTransitionsArray()
public void reduce()
public void sortTransitions(Comparator<Transition> comparator)
public int getNumber()
Expert: Will be useless unless Automaton.getNumberedStates()
has been called first to number the states.
public String toString()
Automaton.toString()
.public int compareTo(State s)
compareTo
in interface Comparable<State>
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.