1 13 14 package mondrian.olap; 15 import mondrian.calc.Calc; 16 import mondrian.calc.ExpCompiler; 17 18 import java.io.PrintWriter ; 19 20 23 public abstract class ExpBase 24 extends QueryPart 25 implements Exp { 26 27 28 protected static Exp[] cloneArray(Exp[] a) { 29 Exp[] a2 = new Exp[a.length]; 30 for (int i = 0; i < a.length; i++) { 31 a2[i] = a[i].clone(); 32 } 33 return a2; 34 } 35 36 protected ExpBase() { 37 } 38 39 public abstract Exp clone(); 40 41 public static void unparseList( 42 PrintWriter pw, 43 Exp[] exps, 44 String start, 45 String mid, 46 String end) 47 { 48 pw.print(start); 49 for (int i = 0; i < exps.length; i++) { 50 if (i > 0) { 51 pw.print(mid); 52 } 53 exps[i].unparse(pw); 54 } 55 pw.print(end); 56 } 57 58 public static int[] getTypes(Exp[] exps) { 59 int[] types = new int[exps.length]; 60 for (int i = 0; i < exps.length; i++) { 61 types[i] = exps[i].getCategory(); 62 } 63 return types; 64 } 65 66 public Calc accept(ExpCompiler compiler) { 67 throw new UnsupportedOperationException (this.toString()); 68 } 69 } 70 71 | Popular Tags |