Class State
- java.lang.Object
-
- org.apache.pinot.segment.local.utils.nativefst.automaton.State
-
- All Implemented Interfaces:
Serializable,Comparable<State>
public class State extends Object implements Serializable, Comparable<State>
Automaton state.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description State()Constructs a new state.
-
Method Summary
Modifier and Type Method Description voidaddTransition(Transition t)Adds an outgoing transition.intcompareTo(State s)Compares this object with the specified object for order.booleanequals(Object obj)List<Transition>getSortedTransitions(boolean toFirst)Returns sorted list of outgoing transitions.Set<Transition>getTransitionSet()Returns the set of outgoing transitions.inthashCode()SeeObject.hashCode().voidsetAccept(boolean accept)Sets acceptance for this state.Statestep(char c)Performs lookup in transitions, assuming determinism.voidstep(char c, Collection<State> dest)Performs lookup in transitions, allowing nondeterminism.StringtoString()Returns string describing this state.
-
-
-
Method Detail
-
getTransitionSet
public Set<Transition> getTransitionSet()
Returns the set of outgoing transitions. Subsequent changes are reflected in the automaton.- Returns:
- transition set
-
addTransition
public void addTransition(Transition t)
Adds an outgoing transition.- Parameters:
t- transition
-
setAccept
public void setAccept(boolean accept)
Sets acceptance for this state.- Parameters:
accept- if true, this state is an accept state
-
step
public State step(char c)
Performs lookup in transitions, assuming determinism.- Parameters:
c- character to look up- Returns:
- destination state, null if no matching outgoing transition
- See Also:
step(char, Collection)
-
step
public void step(char c, Collection<State> dest)Performs lookup in transitions, allowing nondeterminism.- Parameters:
c- character to look updest- collection where destination states are stored- See Also:
step(char)
-
getSortedTransitions
public List<Transition> getSortedTransitions(boolean toFirst)
Returns sorted list of outgoing transitions.- Parameters:
toFirst- if true, order by (to, min, reverse max); otherwise (min, reverse max, to)- Returns:
- transition list
-
toString
public String toString()
Returns string describing this state. Normally invoked viaAutomaton.toString().
-
compareTo
public int compareTo(State s)
Compares this object with the specified object for order. States are ordered by the time of construction.- Specified by:
compareToin interfaceComparable<State>
-
hashCode
public int hashCode()
SeeObject.hashCode().
-
-