org.jscience.computing.automaton
Class State

java.lang.Object
  extended by org.jscience.computing.automaton.State
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class State
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

Automaton state.

See Also:
Serialized Form

Constructor Summary
State()
          Constructs new state.
 
Method Summary
 void addTransition(Transition t)
          Adds outgoing transition.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 java.util.Set<Transition> getTransitions()
          Returns set of outgoing transitions.
 boolean isAccept()
          Returns acceptance status.
 void setAccept(boolean accept)
          Sets acceptance for this state.
 State step(char c)
          Performs lookup in transitions.
 java.lang.String toString()
          Returns string describing this state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

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

Method Detail

getTransitions

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

Returns:
transition set

addTransition

public void addTransition(Transition t)
Adds 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

public State step(char c)
Performs lookup in transitions.

Parameters:
c - character to look up
Returns:
destination state, null if no matching outgoing transition

toString

public java.lang.String toString()
Returns string describing this state. Normally invoked via Automaton.toString().

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. States are ordered by the time of construction.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!