Package dk.brics.automaton
Class State
java.lang.Object
dk.brics.automaton.State
- All Implemented Interfaces:
Serializable,Comparable<State>
Automaton state.- Author:
- Anders Møller <amoeller@cs.au.dk>
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an outgoing transition.intCompares this object with the specified object for order.booleangetSortedTransitions(boolean to_first) Returns sorted list of outgoing transitions.Returns the set of outgoing transitions.inthashCode()SeeObject.hashCode().booleanisAccept()Returns acceptance status.voidsetAccept(boolean accept) Sets acceptance for this state.step(char c) Performs lookup in transitions, assuming determinism.voidstep(char c, Collection<State> dest) Performs lookup in transitions, allowing nondeterminism.toString()Returns string describing this state.
-
Constructor Details
-
State
public State()Constructs a new state. Initially, the new state is a reject state.
-
-
Method Details
-
getTransitions
Returns the set of outgoing transitions. Subsequent changes are reflected in the automaton.- Returns:
- transition set
-
addTransition
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
-
isAccept
public boolean isAccept()Returns acceptance status.- Returns:
- true is this is an accept state
-
step
Performs lookup in transitions, assuming determinism.- Parameters:
c- character to look up- Returns:
- destination state, null if no matching outgoing transition
- See Also:
-
step
Performs lookup in transitions, allowing nondeterminism.- Parameters:
c- character to look updest- collection where destination states are stored- See Also:
-
getSortedTransitions
Returns sorted list of outgoing transitions.- Parameters:
to_first- if true, order by (to, min, reverse max); otherwise (min, reverse max, to)- Returns:
- transition list
-
toString
Returns string describing this state. Normally invoked viaAutomaton.toString(). -
compareTo
Compares this object with the specified object for order. States are ordered by the time of construction.- Specified by:
compareToin interfaceComparable<State>
-
equals
-
hashCode
public int hashCode()SeeObject.hashCode().
-