1 22 23 package org.xquark.extractor.algebra; 24 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 import org.xquark.extractor.common.Debug; 29 import org.xquark.extractor.common.SqlWrapperException; 30 31 35 public final class TopLevelProjectsVisitor extends DefaultAlgebraVisitor { 36 private static final String RCSRevision = "$Revision: 1.6 $"; 37 private static final String RCSName = "$Name: $"; 38 39 private List _topLevelProjectList = new ArrayList (); 40 41 public TopLevelProjectsVisitor() { 42 } 43 44 public void reinit() { 45 _topLevelProjectList.clear(); 46 } 47 48 public List getProjectList(){ 49 Debug.assertTrue(!_topLevelProjectList.isEmpty(),"!_topLevelProjectList.isEmpty()"); 50 return _topLevelProjectList; 51 } 52 53 public void visit(Expression arg) throws SqlWrapperException { 54 Debug.assertTrue(false, "NYI for " + arg.pprint()); 55 } 56 57 public void visit(BinaryAlgebra arg) throws SqlWrapperException { 58 arg.getLeftOperand().accept(this); 60 arg.getRightOperand().accept(this); 61 } 63 64 public void visit(Join arg) throws SqlWrapperException { 65 67 List list = arg.getOperands(); 68 Debug.assertTrue(null!=list,"null!=list"); 69 70 Expression expr = null ; 71 for (int i = 0; i < list.size(); i++) { 72 expr = (Expression)list.get(i); 73 expr.accept(this); 74 } 75 76 } 78 79 public void visit(UnaryAlgebra arg) throws SqlWrapperException { 80 82 Expression operand = arg.getOperand(); 83 operand.accept(this); 84 85 } 87 88 public void visit(UnOpProject arg) throws SqlWrapperException { 89 91 _topLevelProjectList.add(arg); 92 93 } 95 } 96 | Popular Tags |