KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#2 $
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-2006 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.Evaluator;
13 import mondrian.olap.Exp;
14 import mondrian.olap.type.BooleanType;
15 import mondrian.calc.*;
16
17 /**
18  * Abstract implementation of the {@link mondrian.calc.BooleanCalc} interface.
19  *
20  * <p>The derived class must
21  * implement the {@link #evaluateBoolean(mondrian.olap.Evaluator)} method,
22  * and the {@link #evaluate(mondrian.olap.Evaluator)} method will call it.
23  *
24  * @author jhyde
25  * @version $Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#2 $
26  * @since Sep 26, 2005
27  */

28 public abstract class AbstractBooleanCalc
29         extends AbstractCalc
30         implements BooleanCalc {
31     private final Calc[] calcs;
32
33     public AbstractBooleanCalc(Exp exp, Calc[] calcs) {
34         super(exp);
35         this.calcs = calcs;
36         assert getType() instanceof BooleanType;
37     }
38
39     public Object JavaDoc evaluate(Evaluator evaluator) {
40         return Boolean.valueOf(evaluateBoolean(evaluator));
41     }
42
43     public Calc[] getCalcs() {
44         return calcs;
45     }
46 }
47
48 // End AbstractBooleanCalc.java
49
Popular Tags