laser.regularlanguage.util
Class REtoDFAParser<L extends LabelInterface>

java.lang.Object
  extended by laser.regularlanguage.util.REtoDFAParser<L>
Type Parameters:
L - The type of labels used by the REs and DFAs
Direct Known Subclasses:
StringREtoDFAParser

public class REtoDFAParser<L extends LabelInterface>
extends java.lang.Object

The REtoDFAParser class converts from the input RE to its corresponding DFA.

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

Constructor Summary
REtoDFAParser(REFactory<L> reFactory, FSAFactoryInterface<L> dfaFactory, RLFactory<L> rlFactory)
          Creates a new REtoDFAParser.
 
Method Summary
protected  REReader<L> createREReader(REFactory<L> reFactory)
          Creates the appropriate REReader.
protected  REtoDFAConverter<L> createREtoDFAConverter(FSAFactoryInterface<L> fsaFactory, RLFactory<L> rlFactory)
          Creates the appropriate REtoFSAConverter.
 MutableFSAInterface<L> parse(java.io.File inFile)
          Converts from the input RE to its corresponding DFA.
 MutableFSAInterface<L> parse(java.io.Reader in)
          Converts from the input RE to its corresponding DFA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

REtoDFAParser

public REtoDFAParser(REFactory<L> reFactory,
                     FSAFactoryInterface<L> dfaFactory,
                     RLFactory<L> rlFactory)
Creates a new REtoDFAParser.

Parameters:
reFactory - The RE factory to be used to create new REs (non-null)
dfaFactory - The FSA factory to be used to create new DFAs (non-null)
rlFactory - The RL factory to be used to convert between REs and FSAs (non-null)
Method Detail

createREReader

protected REReader<L> createREReader(REFactory<L> reFactory)
Creates the appropriate REReader.

Parameters:
reFactory - The RE factory to be used to create new REs
Returns:
The appropriate REReader

createREtoDFAConverter

protected REtoDFAConverter<L> createREtoDFAConverter(FSAFactoryInterface<L> fsaFactory,
                                                     RLFactory<L> rlFactory)
Creates the appropriate REtoFSAConverter.

Parameters:
fsaFactory - The FSA factory to be used to create new FSAs
rlFactory - The RL factory to be used to convert from RE to FSA args
Returns:
The appropriate REtoFSAConverter

parse

public MutableFSAInterface<L> parse(java.io.File inFile)
                                                    throws FSAInterfaceException,
                                                           java.io.IOException,
                                                           REException
Converts from the input RE to its corresponding DFA.

Parameters:
inFile - The input File that contains the RE (non-null)
Returns:
The corresponding DFA
Throws:
FSAInterfaceException - if an FSA related error occurs during the conversion
java.io.IOException - if an I/O error occurs
REException - if an RE related error occurs during the conversion

parse

public MutableFSAInterface<L> parse(java.io.Reader in)
                                                    throws FSAInterfaceException,
                                                           java.io.IOException,
                                                           REException
Converts from the input RE to its corresponding DFA.

Parameters:
in - The input Reader that contains the RE (non-null)
Returns:
The corresponding DFA
Throws:
FSAInterfaceException - if an FSA related error occurs during the conversion
java.io.IOException - if an I/O error occurs
REException - if an RE related error occurs during the conversion