org.apache.pig.impl.plan
Class PlanVisitor<O extends Operator,P extends OperatorPlan<O>>

java.lang.Object
  extended by org.apache.pig.impl.plan.PlanVisitor<O,P>
Direct Known Subclasses:
MROpPlanVisitor, PhyPlanVisitor, PlanPrinter

public abstract class PlanVisitor<O extends Operator,P extends OperatorPlan<O>>
extends Object

A visitor mechanism for navigating and operating on a plan of Operators. This class contains the logic to traverse the plan. It does not visit individual nodes. That is left to implementing classes (such as LOVisitor).


Field Summary
protected  PlanWalker<O,P> mCurrentWalker
          Guaranteed to always point to the walker currently being used.
protected  P mPlan
           
 
Constructor Summary
protected PlanVisitor(P plan, PlanWalker<O,P> walker)
           
 
Method Summary
 P getPlan()
           
protected  void popWalker()
          Pop the next to previous walker off of the stack and set it as the current walker.
protected  void pushWalker(PlanWalker<O,P> walker)
          Push the current walker onto the stack of saved walkers and begin using the newly passed walker as the current walker.
 void visit()
          Entry point for visiting the plan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPlan

protected P extends OperatorPlan<O> mPlan

mCurrentWalker

protected PlanWalker<O extends Operator,P extends OperatorPlan<O>> mCurrentWalker
Guaranteed to always point to the walker currently being used.

Constructor Detail

PlanVisitor

protected PlanVisitor(P plan,
                      PlanWalker<O,P> walker)
Parameters:
plan - OperatorPlan this visitor will visit.
walker - PlanWalker this visitor will use to traverse the plan.
Method Detail

visit

public void visit()
           throws VisitorException
Entry point for visiting the plan.

Throws:
VisitorException - if an error is encountered while visiting.

getPlan

public P getPlan()

pushWalker

protected void pushWalker(PlanWalker<O,P> walker)
Push the current walker onto the stack of saved walkers and begin using the newly passed walker as the current walker.

Parameters:
walker - new walker to set as the current walker.

popWalker

protected void popWalker()
                  throws VisitorException
Pop the next to previous walker off of the stack and set it as the current walker. This will drop the reference to the current walker.

Throws:
VisitorException - if there are no more walkers on the stack. In this case the current walker is not reset.


Copyright © ${year} The Apache Software Foundation