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

java.lang.Object
  extended by laser.regularlanguage.fsa.AbstractFSA<L>
      extended by laser.regularlanguage.fsa.AbstractRunnableFSA<L>
          extended by laser.regularlanguage.fsa.RunnableFSA<L>
Type Parameters:
L - The type of Label associated with this FSA.
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ArtifactInterface, FSAInterface<L>, RunnableFSAInterface<L>, Annotatable, Persistent, Visualizable
Direct Known Subclasses:
RunnableDFA

public class RunnableFSA<L extends LabelInterface>
extends AbstractRunnableFSA<L>

This class represents FSAs that are runnable.

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

Author:
Nathan A. Jokel (laser-software@cs.umass.edu)
See Also:
RunnableFSAInterface, Serialized Form

Field Summary
 
Fields inherited from class laser.regularlanguage.fsa.AbstractRunnableFSA
table
 
Fields inherited from class laser.regularlanguage.fsa.AbstractFSA
_alphabet, _factory, _nextStateID, _nextTransitionID, _startState, _states, _transitionIndex, _transitions
 
Fields inherited from interface laser.util.Persistent
PER_EXTENSION, READ_PERSISTENT_METHOD_NAME
 
Constructor Summary
protected RunnableFSA(AbstractFSA<L> fsa, java.lang.Class<? extends AbstractFSATransitionTable> tableClass)
          Creates a new runnable FSA with the same states, transitions, and Alphabet as the specified FSA and an AbstractFSATransitionTable of the specified Class.
 
Method Summary
 RunnableFSA<L> clone()
          Returns a copy of this runnable FSA.
 java.util.SortedSet<? extends FSAStateInterface<L>> getInitialConfigurationForwards()
          Returns a SortedSet containing the initial states of this FSA.
 boolean supportsEpsilonTransitions()
          Returns true if this FSA supports epsilon transitions and false otherwise.
 boolean supportsNondeterminism()
          Returns true if this FSA supports nondeterminism and false otherwise.
 
Methods inherited from class laser.regularlanguage.fsa.AbstractRunnableFSA
_checkBackwardsConfiguration, _checkConfiguration, _checkForwardsConfiguration, checkWellFormed, getAcceptStates, getMutableFSA, getNonAcceptStates, initializeFields, isAcceptedStringBackwards, isAcceptedStringForwards, isDeterministic, isFinalConfigurationBackwards, isFinalConfigurationForwards, isTotal, runBackwards, runBackwards, runForwards, runForwards, supportsLabelPatterns, supportsRunningBackwards
 
Methods inherited from class laser.regularlanguage.fsa.AbstractFSA
_checkLabel, _checkState, _checkTransition, _internalAddTransition, _internalCopyFSAAttributes, _internalRemoveState, _internalRemoveTransition, addAnnotation, addAnnotations, copyAnnotations, getAlphabet, getAnnotationClasses, getAnnotationClasses, getAnnotationFilters, getAnnotations, getAnnotations, getDescription, getDotWriter, getEpsilonTransition, getFactory, getName, getStartState, getStates, getStateWithID, getTransition, getTransitions, getTransitions, getTransitionWithID, getVisExtension, hasTransitionsOnEpsilon, readPersistent, readPersistent, removeAnnotation, removeAnnotations, removeAnnotations, removeAnnotations, setAnnotationFilters, setDescription, setName, toDot, toDot, visualize, visualize, writePersistent, writePersistent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface laser.regularlanguage.fsa.FSAInterface
getAlphabet, getDescription, getEpsilonTransition, getFactory, getName, getStartState, getStates, getStateWithID, getTransition, getTransitions, getTransitions, getTransitionWithID, hasTransitionsOnEpsilon, setDescription, setName
 
Methods inherited from interface laser.util.Annotatable
addAnnotation, addAnnotations, copyAnnotations, getAnnotationClasses, getAnnotationClasses, getAnnotationFilters, getAnnotations, getAnnotations, removeAnnotation, removeAnnotations, removeAnnotations, removeAnnotations, setAnnotationFilters
 
Methods inherited from interface laser.util.Persistent
writePersistent, writePersistent
 
Methods inherited from interface laser.util.Visualizable
getVisExtension, visualize, visualize
 

Constructor Detail

RunnableFSA

protected RunnableFSA(AbstractFSA<L> fsa,
                      java.lang.Class<? extends AbstractFSATransitionTable> tableClass)
Creates a new runnable FSA with the same states, transitions, and Alphabet as the specified FSA and an AbstractFSATransitionTable of the specified Class.

Precondition: fsa and tableClass are not null. AbstractFSATransitionTables of tableClass have a constructor that takes a single RunnableFSA parameter.

Note this constructor should only be called by the AbstractFSAFactory._internalGetRunnableFSA(laser.regularlanguage.fsa.MutableFSA) and clone() methods and by constructors of subclasses of this class.

Parameters:
fsa - The FSA.
tableClass - The class of AbstractFSATransitionTable to use.
Throws:
InconsistentObjectError - if there is a problem instantiating the transition table.
See Also:
AbstractFSAFactory._internalGetRunnableFSA(laser.regularlanguage.fsa.MutableFSA), clone()
Method Detail

clone

public RunnableFSA<L> clone()
Returns a copy of this runnable FSA.

Specified by:
clone in interface FSAInterface<L extends LabelInterface>
Specified by:
clone in class AbstractRunnableFSA<L extends LabelInterface>
Returns:
A copy of this runnable FSA.

getInitialConfigurationForwards

public java.util.SortedSet<? extends FSAStateInterface<L>> getInitialConfigurationForwards()
Returns a SortedSet containing the initial states of this FSA.

Formally, call the returned set of states S. S = q0 ∪ E where E =

empty if this FSA does not support epsilon transitions

epsilonClosureForwards(q0) otherwise

Returns:
a SortedSet containing the initial states of this FSA.
See Also:
RunnableFSAInterface

supportsEpsilonTransitions

public boolean supportsEpsilonTransitions()
Returns true if this FSA supports epsilon transitions and false otherwise.

Returns:
True if epsilon transitions are supported and false otherwise

supportsNondeterminism

public boolean supportsNondeterminism()
Returns true if this FSA supports nondeterminism and false otherwise.

Returns:
True if nondeterminism is supported and false otherwise