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

java.lang.Object
  extended by laser.regularlanguage.regularexpression.AbstractREVisitor<L>
Type Parameters:
L - The type of Label associated with the regular expressions
All Implemented Interfaces:
REVisitor<L>
Direct Known Subclasses:
AbstractREConverter, AbstractREtoDFAVisitor, REPrinter, REtoNFAConverter, StringREtoREConverter

public abstract class AbstractREVisitor<L extends LabelInterface>
extends java.lang.Object
implements REVisitor<L>

The AbstractREVisitor class implements the visitor pattern. It is the visitor type. For each method, a default implementation is provided.

NOTE: The context could be declared as a generic parameter.

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

Field Summary
protected  java.lang.Object result
          The result of applying this REVisitor
 
Constructor Summary
AbstractREVisitor()
           
 
Method Summary
 void caseChoiceNode(ChoiceNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given ChoiceNode.
 void caseClassSetNode(ClassSetNode<L> node, java.lang.Object context)
          Allows this Visitor to process the given ClassSetNode.
 void caseConcatenationNode(ConcatenationNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given ConcatenationNode.
 void caseDotNode(DotNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given DotNode.
 void caseEmptyNode(EmptyNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given EmptyNode.
 void caseEpsilonNode(EpsilonNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given EpsilonNode.
 void caseExponentNode(ExponentNode<L> node, java.lang.Object context)
          Allows this Visitor to process the given ExponentNode.
 void caseKleenePlusNode(KleenePlusNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given KleenePlusNode.
 void caseKleeneStarNode(KleeneStarNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given KleeneStarNode.
 void caseLabelNode(LabelNode<L> node, java.lang.Object context)
          Allows this REVisitor to process the given LabelNode.
 void caseNotClassSetNode(NotClassSetNode<L> node, java.lang.Object context)
          Allows this Visitor to process the given NotClassSetNode.
 void caseOptionNode(OptionNode<L> node, java.lang.Object context)
          Allows this Visitor to process the given OptionNode
 void defaultCase(java.lang.Object node)
          Performs the default action.
 java.lang.Object getResult()
          Gets the result of applying this REVisitor.
 void setResult(java.lang.Object result)
          Sets the result of applying this REVisitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

result

protected java.lang.Object result
The result of applying this REVisitor

Constructor Detail

AbstractREVisitor

public AbstractREVisitor()
Method Detail

caseChoiceNode

public void caseChoiceNode(ChoiceNode<L> node,
                           java.lang.Object context)
                    throws REVisitorException
Allows this REVisitor to process the given ChoiceNode.

Specified by:
caseChoiceNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The ChoiceNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseConcatenationNode

public void caseConcatenationNode(ConcatenationNode<L> node,
                                  java.lang.Object context)
                           throws REVisitorException
Allows this REVisitor to process the given ConcatenationNode.

Specified by:
caseConcatenationNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The ConcatenationNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseDotNode

public void caseDotNode(DotNode<L> node,
                        java.lang.Object context)
                 throws REVisitorException
Allows this REVisitor to process the given DotNode.

Specified by:
caseDotNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The DotNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseEmptyNode

public void caseEmptyNode(EmptyNode<L> node,
                          java.lang.Object context)
                   throws REVisitorException
Allows this REVisitor to process the given EmptyNode.

Specified by:
caseEmptyNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The EmptyNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseEpsilonNode

public void caseEpsilonNode(EpsilonNode<L> node,
                            java.lang.Object context)
                     throws REVisitorException
Allows this REVisitor to process the given EpsilonNode.

Specified by:
caseEpsilonNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The EpsilonNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseExponentNode

public void caseExponentNode(ExponentNode<L> node,
                             java.lang.Object context)
                      throws REVisitorException
Allows this Visitor to process the given ExponentNode.

Specified by:
caseExponentNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The ExponentNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseKleenePlusNode

public void caseKleenePlusNode(KleenePlusNode<L> node,
                               java.lang.Object context)
                        throws REVisitorException
Allows this REVisitor to process the given KleenePlusNode.

Specified by:
caseKleenePlusNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The KleenePlusNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseKleeneStarNode

public void caseKleeneStarNode(KleeneStarNode<L> node,
                               java.lang.Object context)
                        throws REVisitorException
Allows this REVisitor to process the given KleeneStarNode.

Specified by:
caseKleeneStarNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The KleeneStarNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseLabelNode

public void caseLabelNode(LabelNode<L> node,
                          java.lang.Object context)
                   throws REVisitorException
Allows this REVisitor to process the given LabelNode.

Specified by:
caseLabelNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The LabelNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseClassSetNode

public void caseClassSetNode(ClassSetNode<L> node,
                             java.lang.Object context)
                      throws REVisitorException
Allows this Visitor to process the given ClassSetNode.

Specified by:
caseClassSetNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The ClassSetNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseNotClassSetNode

public void caseNotClassSetNode(NotClassSetNode<L> node,
                                java.lang.Object context)
                         throws REVisitorException
Allows this Visitor to process the given NotClassSetNode.

Specified by:
caseNotClassSetNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The NotClassSetNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

caseOptionNode

public void caseOptionNode(OptionNode<L> node,
                           java.lang.Object context)
                    throws REVisitorException
Allows this Visitor to process the given OptionNode

Specified by:
caseOptionNode in interface REVisitor<L extends LabelInterface>
Parameters:
node - The OptionNode to be processed
context - The calling context
Throws:
REVisitorException - if an error occurs

defaultCase

public void defaultCase(java.lang.Object node)
                 throws REVisitorException
Performs the default action.

Specified by:
defaultCase in interface REVisitor<L extends LabelInterface>
Parameters:
node - The Object to be processed
Throws:
REVisitorException - if an error occurs

getResult

public java.lang.Object getResult()
Gets the result of applying this REVisitor.

Returns:
The result of applying this REVisitor

setResult

public void setResult(java.lang.Object result)
Sets the result of applying this REVisitor.

Parameters:
result - The result of applying this REVisitor