dk.brics.automaton

Class State

public class State extends Object implements Serializable, Comparable<State>

Automaton state.

Author: Anders Møller <amoeller@cs.au.dk>

Constructor Summary
State()
Constructs a new state.
Method Summary
voidaddTransition(Transition t)
Adds an outgoing transition.
intcompareTo(State s)
Compares this object with the specified object for order.
List<Transition>getSortedTransitions(boolean to_first)
Returns sorted list of outgoing transitions.
Set<Transition>getTransitions()
Returns the set of outgoing transitions.
booleanisAccept()
Returns acceptance status.
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.

Constructor Detail

State

public State()
Constructs a new state. Initially, the new state is a reject state.

Method Detail

addTransition

public void addTransition(Transition t)
Adds an outgoing transition.

Parameters: t transition

compareTo

public int compareTo(State s)
Compares this object with the specified object for order. States are ordered by the time of construction.

getSortedTransitions

public List<Transition> getSortedTransitions(boolean to_first)
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

getTransitions

public Set<Transition> getTransitions()
Returns the set of outgoing transitions. Subsequent changes are reflected in the automaton.

Returns: transition set

isAccept

public boolean isAccept()
Returns acceptance status.

Returns: true is this is an accept state

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: State

step

public void step(char c, Collection<State> dest)
Performs lookup in transitions, allowing nondeterminism.

Parameters: c character to look up dest collection where destination states are stored

See Also: State

Copyright © 2001-2010 Anders Møller.