1 22 23 package org.xquark.extractor.algebra; 24 25 import java.util.List ; 26 import java.util.Map ; 27 28 import org.xquark.extractor.common.SqlWrapperException; 29 import org.xquark.extractor.sql.SqlExpression; 30 31 public final class UnOpGroup extends UnaryAlgebra 32 { 33 34 private static final String RCSRevision = "$Revision: 1.5 $"; 35 private static final String RCSName = "$Name: $"; 36 37 38 private List _groupExpressionList; 39 40 public UnOpGroup(Expression operand, List groupExpressionList) 41 { 42 super(operand); 43 setGroupExpressionList ( groupExpressionList ) ; 44 } 45 46 synchronized Object clone(Map clonedExprs) throws CloneNotSupportedException 47 { 48 UnOpGroup retVal = (UnOpGroup)super.clone(clonedExprs); 49 retVal.setGroupExpressionList(AlgebraTools.clone(_groupExpressionList,clonedExprs)); 50 51 clonedExprs.put(this, retVal); 52 return retVal; 53 } 54 55 60 public List getGroupExpressionList() 61 { 62 return _groupExpressionList ; 63 } 64 65 public List getParameterList() 66 { 67 return getGroupExpressionList(); 68 } 69 70 76 public void setGroupExpressionList(List aGroupExpressionList) 77 { 78 _groupExpressionList = aGroupExpressionList; 79 if ( null != _groupExpressionList) { 80 Expression expr = null; 81 for (int i = 0; i < _groupExpressionList.size(); i++) { 82 expr = (Expression)_groupExpressionList.get(i); 83 expr.setFather(this); 84 } 85 } 86 } 87 88 public List getKeys() { 89 return _groupExpressionList; 90 } 91 92 public boolean replaceChild(Expression oldChild, Expression newChild) 93 { 94 boolean retVal = false; 95 96 List list = getGroupExpressionList(); 97 98 Expression expr = null ; 99 for (int i = 0; i < list.size(); i++) { 100 expr = (Expression)list.get(i); 101 if (expr.equals(oldChild)) { 102 list.set(i, newChild); 103 newChild.setFather(this); 104 retVal = true; 105 break; 106 } 107 } 108 109 if (getOperand().equals(oldChild)) { 110 setOperand(newChild); 111 retVal = true; 112 } 113 114 return retVal; 115 } 116 117 public SqlExpression accept (GenSqlVisitor visitor) throws SqlWrapperException 118 { 119 return visitor.visit(this); 120 } 121 122 public void accept (AlgebraVisitor visitor) throws SqlWrapperException 123 { 124 visitor.visit(this); 125 } 126 127 130 public boolean deepEquals(Object o) 131 { 132 if (o instanceof UnOpGroup) 133 { 134 UnOpGroup cast = (UnOpGroup)o; 135 return super.deepEquals(o) 136 && AlgebraTools.areExprListEquivalent(_groupExpressionList, cast.getGroupExpressionList()); 137 } 138 return false; 139 } 140 } 141 | Popular Tags |