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

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

public class ProductComposer<L extends LabelInterface>
extends AbstractComposer<L>

The ProductComposer class computes the (cross) product FSA from the given FSAs.

Author:
Heather M. Conboy (laser-software@cs.umass.edu)

Constructor Summary
ProductComposer(FSAFactoryInterface<L> fsaFactory)
          Creates a new ProductComposer.
 
Method Summary
 java.util.Set<L> getLabels(RunnableFSAInterface<L> fsa1, RunnableFSAInterface<L> fsa2)
          Gets the Set of labels for which transitions should be added.
 boolean isAccept(CompositeState<L> composite)
          Determines whether or not the given composite state should be accepting.
 FSAPair<L> preprocess(RunnableFSAInterface<L> fsa1, RunnableFSAInterface<L> fsa2)
          Performs any necessary preprocessing before composing the given FSAs.
 
Methods inherited from class laser.regularlanguage.fsa.util.AbstractComposer
getCreateArgs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductComposer

public ProductComposer(FSAFactoryInterface<L> fsaFactory)
Creates a new ProductComposer.

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

getLabels

public 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.

Specified by:
getLabels in class AbstractComposer<L extends LabelInterface>
Parameters:
fsa1 - The first FSA
fsa2 - The second FSA
Returns:
The Set of labels for which transitions should be added

isAccept

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

Specified by:
isAccept in class AbstractComposer<L extends LabelInterface>
Parameters:
composite - the composite state
Returns:
true if it should be accepting, false otherwise

preprocess

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

Specified by:
preprocess in class AbstractComposer<L extends LabelInterface>
Parameters:
fsa1 - The first FSA
fsa2 - The second FSA
Returns:
A List that contains the first FSA and second FSA after being preprocessed