1 22 23 package org.xquark.mediator.algebra; 24 25 import org.xquark.mediator.plan.*; 26 import org.xquark.mediator.plan.primitivefunctions.OpFuncDISTINCT_VALUES; 27 import org.xquark.mediator.runtime.MediatorException; 28 import org.xquark.xquery.parser.*; 29 import org.xquark.xquery.parser.primitivefunctions.fnfunctions.FunctionDISTINCT_VALUES; 30 31 36 public class AlgFunction extends Algebra { 37 private static final String RCSRevision = "$Revision: 1.7 $"; 41 private static final String RCSName = "$Name: $"; 42 48 51 61 public AlgFunction(XQueryExpression expression, Variable var, AlgebraManager depmanager, boolean islet) throws MediatorException { 62 super(expression, var, depmanager, islet); 63 fillVarLists(); 66 } 67 68 72 public void ParentHasIdentifier() { 73 hasIdentifier = true; 74 } 75 76 84 public Operator createOperator(ExecutionPlan plan) throws MediatorException { 85 86 88 Operator algebra = null; 89 if (algChildren != null) { 90 for (int i = 0; i < algChildren.size(); i++) { 91 Algebra depchildi = (Algebra) algChildren.get(i); 93 if (algebra == null) 106 algebra = (Operator) depchildi.createOperator(plan); 107 else 108 algebra = new OpMerge(plan, null, algebra, (Operator) depchildi.createOperator(plan)); 109 } 110 111 113 if (expression instanceof AggregateFunctionCall) 114 algebra = new OpAggregateFunc(plan, expression, algebra); 115 else if (expression instanceof FunctionDISTINCT_VALUES) 116 algebra = new OpFuncDISTINCT_VALUES(plan, expression, algebra); 118 else if (expression instanceof PrimitiveFunctionCall) 119 algebra = new OpFunc(plan, expression, algebra); 120 else 121 throw new MediatorException("Not yet implemented : create algebra for function -> " + expression.getClass().getName()); 122 algebra = new OpNotSource(plan, null, (Variable) variables.get(0), algebra, this.islet); 123 } 124 else 125 algebra = new OpEval(plan,this,null,hasIdentifier); 126 127 199 200 algebra.isLet(islet); 201 return algebra; 202 } 203 204 public Object clone() throws CloneNotSupportedException { 205 AlgFunction newobj = (AlgFunction) super.clone(); 206 return newobj; 207 } 208 209 public void execute(ExecutionPlan plan) throws MediatorException {} 210 211 } 215 | Popular Tags |