laser.regularlanguage.fsa.util
Class AbstractComposer<L extends LabelInterface>

java.lang.Object
  extended by laser.regularlanguage.fsa.util.AbstractComposer<L>
Type Parameters:
L - The type of labels used by the FSAs
Direct Known Subclasses:
IntersectionComposer, ProductComposer, UnionComposer

public abstract class AbstractComposer<L extends LabelInterface>
extends java.lang.Object

The AbstractComposer class computes the composite FSA from the given FSAs.

Author:
Jamieson M. Cobleigh (laser-software@cs.umass.edu)

Constructor Summary
protected AbstractComposer(FSAFactoryInterface<L> fsaFactory)
          Creates a new AbstractComposer.
 
Method Summary
protected  java.lang.Object[] getCreateArgs(FSAInterface<L> newFSA, FSALabelTransitionInterface<L> oldTransition1, FSALabelTransitionInterface<L> oldTransition2)
          Gets any required arguments for the label transition factory method from the given label transitions.
abstract  java.util.Set<L> getLabels(RunnableFSAInterface<L> fsa1, RunnableFSAInterface<L> fsa2)
          Gets the Set of labels for which transitions should be added.
abstract  boolean isAccept(CompositeState<L> composite)
          Determines whether or not the given composite state should be accepting.
abstract  FSAPair<L> preprocess(RunnableFSAInterface<L> fsa1, RunnableFSAInterface<L> fsa2)
          Performs any necessary preprocessing before composing the given FSAs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractComposer

protected AbstractComposer(FSAFactoryInterface<L> fsaFactory)
Creates a new AbstractComposer.

Parameters:
fsaFactory - The FSAFactoryInterface to be used to create the new FSA (non-null)
Method Detail

getCreateArgs

protected java.lang.Object[] getCreateArgs(FSAInterface<L> newFSA,
                                           FSALabelTransitionInterface<L> oldTransition1,
                                           FSALabelTransitionInterface<L> oldTransition2)
Gets any required arguments for the label transition factory method from the given label transitions.

Parameters:
newFSA - The FSA that will contain the new transition
oldTransition1 - The first old transition to use as a prototype
oldTransition2 - The second old transition to use as a prototype
Returns:
Any required arguments for the new transition

getLabels

public abstract java.util.Set<L> getLabels(RunnableFSAInterface<L> fsa1,
                                           RunnableFSAInterface<L> fsa2)
Gets the Set of labels for which transitions should be added.

NOTE: If an FSA's alphabet does not contain any of the returned labels, then for each FSA's state it is assumed that a self-loop transition exists on each such label.

Parameters:
fsa1 - The first FSA
fsa2 - The second FSA
Returns:
The Set of labels for which transitions should be added

isAccept

public abstract boolean isAccept(CompositeState<L> composite)
Determines whether or not the given composite state should be accepting.

Parameters:
composite - the composite state
Returns:
true if it should be accepting, false otherwise

preprocess

public abstract FSAPair<L> preprocess(RunnableFSAInterface<L> fsa1,
                                      RunnableFSAInterface<L> fsa2)
Performs any necessary preprocessing before composing the given FSAs.

Parameters:
fsa1 - The first FSA
fsa2 - The second FSA
Returns:
The preprocessed FSAs