laser.regularlanguage.fsa
Class FSATransitionTable<L extends LabelInterface>

java.lang.Object
  extended by laser.regularlanguage.fsa.AbstractFSATransitionTable<L>
      extended by laser.regularlanguage.fsa.FSATransitionTable<L>
Type Parameters:
L - The type of Label associated with the FSA that this table is associated with.
All Implemented Interfaces:
java.io.Serializable

public class FSATransitionTable<L extends LabelInterface>
extends AbstractFSATransitionTable<L>

A helper class for RunnableFSAs that allows computation to be performed on them.

Note that this class is not synchronized, and attempts to use it with non-sequential code may result in unexpected behavior.

Author:
Nathan Jokel (laser-software@cs.umass.edu)
See Also:
RunnableFSAInterface.runForwards(java.util.SortedSet>, L), Serialized Form

Field Summary
protected  java.util.SortedSet<?>[] _epsilonClosures
          An array that contains the epsilon closure of each state indexed by the state IDs.
protected  java.util.Map<?,?>[] _sourceIndex
          The top level of a two level index that returns the target states of all transitions with a given source state and Label.
 
Constructor Summary
protected FSATransitionTable(AbstractRunnableFSA<L> fsa)
          Creates a new FSATransitionTable for the specified runnable FSA.
 
Method Summary
protected  java.util.SortedSet<FSAStateInterface<L>> epsilonClosure(FSAStateInterface<L> state)
          A helper method for the RunnableFSAInterface.runForwards(SortedSet, LabelInterface) method that deals with epsilon transitions.
protected  java.util.SortedSet<FSAStateInterface<L>> moveClosure(FSAStateInterface<L> state, L label)
          A helper method for the RunnableFSAInterface.runForwards(SortedSet, LabelInterface) method that deals with label transitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_epsilonClosures

protected java.util.SortedSet<?>[] _epsilonClosures
An array that contains the epsilon closure of each state indexed by the state IDs.


_sourceIndex

protected java.util.Map<?,?>[] _sourceIndex
The top level of a two level index that returns the target states of all transitions with a given source state and Label. This level of the index maps the source state (indexed by its ID) to the second level of the index. The second level of the index maps the Label to the set of target states.

Constructor Detail

FSATransitionTable

protected FSATransitionTable(AbstractRunnableFSA<L> fsa)
Creates a new FSATransitionTable for the specified runnable FSA. This constructor should not be called except by a constructor of RunnableFSA.

Preconditions: fsa is not null.

Parameters:
fsa - The runnable FSA.
See Also:
RunnableFSA
Method Detail

epsilonClosure

protected java.util.SortedSet<FSAStateInterface<L>> epsilonClosure(FSAStateInterface<L> state)
A helper method for the RunnableFSAInterface.runForwards(SortedSet, LabelInterface) method that deals with epsilon transitions.

Precondition: state must not be null and must be a state in the FSA.

Specified by:
epsilonClosure in class AbstractFSATransitionTable<L extends LabelInterface>
See Also:
RunnableFSA.getInitialConfigurationForwards()

moveClosure

protected java.util.SortedSet<FSAStateInterface<L>> moveClosure(FSAStateInterface<L> state,
                                                                L label)
A helper method for the RunnableFSAInterface.runForwards(SortedSet, LabelInterface) method that deals with label transitions.

Precondition: state and label must not be null, state must be a state in the FSA, label must equal a Label in the Alphabet of the FSA.

Specified by:
moveClosure in class AbstractFSATransitionTable<L extends LabelInterface>
See Also:
AbstractRunnableFSA.runForwards(java.util.SortedSet>, L)