1 21 22 23 package org.apache.derby.impl.sql.compile; 24 25 import org.apache.derby.iapi.sql.compile.Visitable; 26 import org.apache.derby.iapi.sql.compile.Visitor; 27 28 import org.apache.derby.iapi.error.StandardException; 29 30 35 public class ReplaceAggregatesWithCRVisitor implements Visitor 36 { 37 private ResultColumnList rcl; 38 private Class skipOverClass; 39 private int tableNumber; 40 41 49 public ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, int tableNumber) 50 { 51 this.rcl = rcl; 52 this.tableNumber = tableNumber; 53 } 54 55 64 public ReplaceAggregatesWithCRVisitor(ResultColumnList rcl, Class nodeToSkip) 65 { 66 this.rcl = rcl; 67 this.skipOverClass = nodeToSkip; 68 } 69 70 71 77 87 public Visitable visit(Visitable node) 88 throws StandardException 89 { 90 if (node instanceof AggregateNode) 91 { 92 95 node = ((AggregateNode)node).replaceAggregatesWithColumnReferences(rcl, tableNumber); 96 } 97 98 return node; 99 } 100 101 107 public boolean skipChildren(Visitable node) 108 { 109 return (skipOverClass == null) ? 110 false: 111 skipOverClass.isInstance(node); 112 } 113 114 public boolean stopTraversal() 115 { 116 return false; 117 } 118 } 119 | Popular Tags |