KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > calc > impl > DelegatingExpCompiler


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/calc/impl/DelegatingExpCompiler.java#8 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2006-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.calc.impl;
11
12 import mondrian.olap.*;
13 import mondrian.calc.*;
14
15 /**
16  * Abstract implementation of {@link mondrian.calc.ExpCompiler}
17  *
18  * @author jhyde
19  * @version $Id: //open/mondrian/src/main/mondrian/calc/impl/DelegatingExpCompiler.java#8 $
20  * @since Jan 2, 2006
21  */

22 public class DelegatingExpCompiler implements ExpCompiler {
23     private final ExpCompiler parent;
24
25     protected DelegatingExpCompiler(ExpCompiler parent) {
26         this.parent = parent;
27     }
28
29     /**
30      * Hook for post-processing.
31      */

32     protected Calc afterCompile(Exp exp, Calc calc, boolean mutable) {
33         return calc;
34     }
35
36     public Evaluator getEvaluator() {
37         return parent.getEvaluator();
38     }
39
40     public Validator getValidator() {
41         return parent.getValidator();
42     }
43
44     public Calc compile(Exp exp) {
45         return parent.compile(exp);
46     }
47
48     public Calc compile(Exp exp, ResultStyle[] preferredResultTypes) {
49         return parent.compile(exp, preferredResultTypes);
50     }
51
52     public MemberCalc compileMember(Exp exp) {
53         MemberCalc calc = parent.compileMember(exp);
54         return (MemberCalc) afterCompile(exp, calc, false);
55     }
56
57     public LevelCalc compileLevel(Exp exp) {
58         final LevelCalc calc = parent.compileLevel(exp);
59         return (LevelCalc) afterCompile(exp, calc, false);
60     }
61
62     public DimensionCalc compileDimension(Exp exp) {
63         final DimensionCalc calc = parent.compileDimension(exp);
64         return (DimensionCalc) afterCompile(exp, calc, false);
65     }
66
67     public HierarchyCalc compileHierarchy(Exp exp) {
68         final HierarchyCalc calc = parent.compileHierarchy(exp);
69         return (HierarchyCalc) afterCompile(exp, calc, false);
70     }
71
72     public IntegerCalc compileInteger(Exp exp) {
73         final IntegerCalc calc = parent.compileInteger(exp);
74         return (IntegerCalc) afterCompile(exp, calc, false);
75     }
76
77     public StringCalc compileString(Exp exp) {
78         final StringCalc calc = parent.compileString(exp);
79         return (StringCalc) afterCompile(exp, calc, false);
80     }
81
82     public ListCalc compileList(Exp exp) {
83         return compileList(exp, false);
84     }
85
86     public ListCalc compileList(Exp exp, boolean mutable) {
87         final ListCalc calc = parent.compileList(exp, mutable);
88         return (ListCalc) afterCompile(exp, calc, mutable);
89     }
90
91     public IterCalc compileIter(Exp exp) {
92         final IterCalc calc = parent.compileIter(exp);
93         return (IterCalc) afterCompile(exp, calc, false);
94     }
95
96     public BooleanCalc compileBoolean(Exp exp) {
97         final BooleanCalc calc = parent.compileBoolean(exp);
98         return (BooleanCalc) afterCompile(exp, calc, false);
99     }
100
101     public DoubleCalc compileDouble(Exp exp) {
102         final DoubleCalc calc = parent.compileDouble(exp);
103         return (DoubleCalc) afterCompile(exp, calc, false);
104     }
105
106     public TupleCalc compileTuple(Exp exp) {
107         final TupleCalc calc = parent.compileTuple(exp);
108         return (TupleCalc) afterCompile(exp, calc, false);
109     }
110
111     public Calc compileScalar(Exp exp, boolean scalar) {
112         final Calc calc = parent.compileScalar(exp, scalar);
113         return afterCompile(exp, calc, false);
114     }
115
116     public ParameterSlot registerParameter(Parameter parameter) {
117         return parent.registerParameter(parameter);
118     }
119
120     public ResultStyle[] getAcceptableResultStyles() {
121         return parent.getAcceptableResultStyles();
122     }
123 }
124
125 // End DelegatingExpCompiler.java
126
Popular Tags