1 package com.daffodilwoods.daffodildb.server.sql99.dql.plan.table; 2 3 import com.daffodilwoods.daffodildb.client.*; 4 import com.daffodilwoods.daffodildb.server.sql99.dql.common.*; 5 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.*; 6 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; 7 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 8 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.predicates.*; 9 import com.daffodilwoods.database.resource.*; 10 11 22 23 public class TemporaryMerge extends OrderTablePlanAbstract implements ExecutionPlanConstants, _TablePlan { 24 25 public TemporaryMerge() { 26 } 27 28 33 34 public booleanvalueexpression getCondition() throws DException { 35 return remainingCondition; 36 } 37 38 43 44 public int getType() throws DException { 45 return TableExpressionConstants.TEMPORARYMERGE; 46 } 47 48 53 54 public void addTablePlan(_TablePlan tablePlan) throws DException { 55 if (this.childPlans != null) { 56 int len = this.childPlans.length; 57 _TablePlan[] tempTablePlans = new _TablePlan[len + 1]; 58 System.arraycopy(this.childPlans, 0, tempTablePlans, 0, len); 59 tempTablePlans[len] = tablePlan; 60 this.childPlans = tempTablePlans; 61 } else { 62 this.childPlans = new _TablePlan[] {tablePlan}; 63 } 64 } 65 66 72 73 public void addCondition(booleanvalueexpression bve) throws DException { 74 remainingCondition = BVEPlanMerger.addAndConditions(remainingCondition, bve); 75 } 76 77 public String toString() { 78 StringBuffer stringBuffer = new StringBuffer (); 79 stringBuffer.append("TemporaryMerge"); 80 for (int i = 0; i < childPlans.length; i++) { 81 stringBuffer.append("["); 82 stringBuffer.append(childPlans[i].toString()); 83 stringBuffer.append("]"); 84 } 85 if (remainingCondition != null) { 86 stringBuffer.append("["); 87 stringBuffer.append(remainingCondition.toString()); 88 stringBuffer.append("]"); 89 } 90 return stringBuffer.toString(); 91 } 92 93 public String getVerifier() throws DException { 94 StringBuffer stringBuffer = new StringBuffer (); 95 stringBuffer.append("TemporaryMerge"); 96 for (int i = 0; i < childPlans.length; i++) { 97 stringBuffer.append("["); 98 stringBuffer.append(childPlans[i].toString()); 99 stringBuffer.append("]"); 100 } 101 if (remainingCondition != null) { 102 stringBuffer.append("["); 103 stringBuffer.append(remainingCondition.toString()); 104 stringBuffer.append("]"); 105 } 106 return stringBuffer.toString(); 107 } 108 109 114 115 public _QueryPlan getQueryPlan() throws DException { 116 int length = childPlans.length; 117 _QueryPlan[] cplans = new _QueryPlan[length]; 118 for (int i = 0; i < length; i++) { 119 cplans[i] = childPlans[i].getQueryPlan(); 120 } 121 String bve = remainingCondition == null ? null : ("" + remainingCondition); 122 return new QueryPlan("TemporaryMerge", cplans, bve, null); 123 } 124 } 125 | Popular Tags |