jpaul.RegExps
Class RegExp.Visitor<A,Res>

java.lang.Object
  extended by jpaul.RegExps.RegExp.Visitor<A,Res>
Enclosing class:
RegExp<A>

public abstract static class RegExp.Visitor<A,Res>
extends java.lang.Object

Instance of the visitor pattern for RegExps. Usage of this pattern avoids clumsy sequences of several instanceof tests. A visitor takers a regular expression over symbols of type A and returns a result of type Res.


Constructor Summary
RegExp.Visitor()
           
 
Method Summary
 Res visit(RegExp.Atomic<A> re)
          Subclasses should override this method to define special processing for an Atomic regular expression.
 Res visit(RegExp.Concat<A> re)
          Subclasses should override this method to define special processing for a Concat regular expression.
 Res visit(RegExp.EmptyStr<A> re)
          Subclasses should override this method to define special processing for an EmptyStr regular expression.
 Res visit(RegExp.None<A> re)
          Subclasses should override this method to define special processing for a None regular expression.
 Res visit(RegExp.Star<A> re)
          Subclasses should override this method to define special processing for a Star regular expression.
 Res visit(RegExp.Union<A> re)
          Subclasses should override this method to define special processing for a Union regular expression.
 Res visit(RegExp<A> re)
          Default code to execute for a regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExp.Visitor

public RegExp.Visitor()
Method Detail

visit

public Res visit(RegExp.None<A> re)
Subclasses should override this method to define special processing for a None regular expression.


visit

public Res visit(RegExp.Atomic<A> re)
Subclasses should override this method to define special processing for an Atomic regular expression.


visit

public Res visit(RegExp.EmptyStr<A> re)
Subclasses should override this method to define special processing for an EmptyStr regular expression.


visit

public Res visit(RegExp.Union<A> re)
Subclasses should override this method to define special processing for a Union regular expression.


visit

public Res visit(RegExp.Concat<A> re)
Subclasses should override this method to define special processing for a Concat regular expression.


visit

public Res visit(RegExp.Star<A> re)
Subclasses should override this method to define special processing for a Star regular expression.


visit

public Res visit(RegExp<A> re)
Default code to execute for a regular expression. If a subclass does not override the processing for a certain RegExp subclass, this code will be executed instead.



Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu