org.pietschy.command
Class AbstractVisitor

java.lang.Object
  extended by org.pietschy.command.AbstractVisitor
All Implemented Interfaces:
GroupVisitor
Direct Known Subclasses:
MatchVisitor, RemoveVisitor, ResetVisitor

public abstract class AbstractVisitor
extends java.lang.Object
implements GroupVisitor

AbstractVisitor provides a default implementation of GroupVisitor that predefines a number of visitation modes by providing a default implementation of conditionallyVisitChildren(org.pietschy.command.CommandGroup).

The available modes are as follows.

SHALLOW
The visitor will visit the parent group and its immediate children only. The children of any inline group will be visited as if they are members of the main group.
DEEP
The visitor traverse the entire graph of commands under the top level group.

Version:
$Revision: 1.5 $
Author:
andrewp

Nested Class Summary
static class AbstractVisitor.VisitMode
           
 
Field Summary
static AbstractVisitor.VisitMode DEEP
          The visitor traverse the entire graph of commands under the top level group.
protected  AbstractVisitor.VisitMode mode
          The mode in which the visitor should operate.
static AbstractVisitor.VisitMode SHALLOW
          The visitor will visit the immediate children only (including inline children).
 
Constructor Summary
AbstractVisitor(AbstractVisitor.VisitMode mode)
          Constructs a new Abstract visitor using the specified visitation mode.
 
Method Summary
 void conditionallyVisitChildren(CommandGroup group)
           
protected  boolean isParentGroup(CommandGroup group)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pietschy.command.GroupVisitor
visit, visit
 

Field Detail

SHALLOW

public static final AbstractVisitor.VisitMode SHALLOW
The visitor will visit the immediate children only (including inline children).


DEEP

public static final AbstractVisitor.VisitMode DEEP
The visitor traverse the entire graph of commands under the top level group.


mode

protected AbstractVisitor.VisitMode mode
The mode in which the visitor should operate.

Constructor Detail

AbstractVisitor

public AbstractVisitor(AbstractVisitor.VisitMode mode)
Constructs a new Abstract visitor using the specified visitation mode.

Parameters:
mode - the AbstractVisitor.VisitMode the visitor should use.
Method Detail

conditionallyVisitChildren

public void conditionallyVisitChildren(CommandGroup group)

isParentGroup

protected boolean isParentGroup(CommandGroup group)