laser.regularlanguage.regularexpression
Class DefaultREFactory<L extends LabelInterface>

java.lang.Object
  extended by laser.regularlanguage.regularexpression.DefaultREFactory<L>
Type Parameters:
L - The type of Label associated with the REs.
All Implemented Interfaces:
java.io.Serializable, REFactory<L>
Direct Known Subclasses:
StringREFactory

public class DefaultREFactory<L extends LabelInterface>
extends java.lang.Object
implements REFactory<L>, java.io.Serializable

The DefaultREFactory class allows the user to create new REs.

Author:
Heather M. Conboy (laser-software@cs.umass.edu)
See Also:
Serialized Form

Constructor Summary
DefaultREFactory(AlphabetFactoryInterface<L> alphabetFactory)
          Creates a new DefaultREFactory.
 
Method Summary
 RE<L> createRE(AlphabetInterface<L> alphabet, TreeNode<L> rootNode, java.lang.Object... args)
          Creates a new RE with the given alphabet and regular expression.
 AlphabetFactoryInterface<L> getAlphabetFactory()
          Gets the alphabet factory to be used to create new alphabets.
 java.lang.Object[] getCreateREArgs(RE<L> oldRE)
          Gets the appropriate arguments for the createRE method from the given RE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultREFactory

public DefaultREFactory(AlphabetFactoryInterface<L> alphabetFactory)
Creates a new DefaultREFactory.

Parameters:
alphabetFactory - The AlphabetFactoryInterface to be used to create new alphabets
Method Detail

createRE

public RE<L> createRE(AlphabetInterface<L> alphabet,
                      TreeNode<L> rootNode,
                      java.lang.Object... args)
Creates a new RE with the given alphabet and regular expression. PRECONDITIONS:

Specified by:
createRE in interface REFactory<L extends LabelInterface>
Parameters:
alphabet - The alphabet for the new RE
rootNode - The regular expression for the new RE
args - Any additional arguments (optional)
Returns:
The new RE
Throws:
IllegalArguemntException - if any precondition is not met

getAlphabetFactory

public AlphabetFactoryInterface<L> getAlphabetFactory()
Gets the alphabet factory to be used to create new alphabets.

Specified by:
getAlphabetFactory in interface REFactory<L extends LabelInterface>
Returns:
The AlphabetFactoryInterface to be used to create new alphabets

getCreateREArgs

public java.lang.Object[] getCreateREArgs(RE<L> oldRE)
Gets the appropriate arguments for the createRE method from the given RE.

PRECONDITIONS:

Specified by:
getCreateREArgs in interface REFactory<L extends LabelInterface>
Parameters:
oldRE - The old RE
Returns:
The appropriate arguments for the createRE method