datastructure
Class State

java.lang.Object
  extended by datastructure.State
All Implemented Interfaces:
java.lang.Comparable

public class State
extends java.lang.Object
implements java.lang.Comparable

This class represents a single state of a FSM, the components being its name and its transitions.

Author:
Leopold Haller

Constructor Summary
State(java.lang.String name)
           
 
Method Summary
 void addTransition(java.lang.String symbol, State... s)
           
 int compareTo(java.lang.Object o)
           
 boolean removeTransition(java.lang.String symbol)
           
 boolean removeTransition(java.lang.String symbol, State s)
           
 java.lang.String toString()
           
 java.util.ArrayList<State> transition(java.lang.String symbol)
          Returns the successors of the state with the given symbol, null if none exist.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State(java.lang.String name)
Method Detail

transition

public java.util.ArrayList<State> transition(java.lang.String symbol)
Returns the successors of the state with the given symbol, null if none exist.

Parameters:
symbol - The symbol to transition with.
Returns:
An arraylist containing the successors, changes in the list reflect in the transitions

addTransition

public void addTransition(java.lang.String symbol,
                          State... s)

removeTransition

public boolean removeTransition(java.lang.String symbol,
                                State s)

removeTransition

public boolean removeTransition(java.lang.String symbol)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable