001 /*
002 // $Id: //open/mondrian-release/3.2/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#1 $
003 // This software is subject to the terms of the Eclipse Public License v1.0
004 // Agreement, available at the following URL:
005 // http://www.eclipse.org/legal/epl-v10.html.
006 // Copyright (C) 2006-2009 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 */
010 package mondrian.calc.impl;
011
012 import mondrian.olap.Evaluator;
013 import mondrian.olap.Exp;
014 import mondrian.olap.type.BooleanType;
015 import mondrian.calc.*;
016
017 /**
018 * Abstract implementation of the {@link mondrian.calc.BooleanCalc} interface.
019 *
020 * <p>The derived class must
021 * implement the {@link #evaluateBoolean(mondrian.olap.Evaluator)} method,
022 * and the {@link #evaluate(mondrian.olap.Evaluator)} method will call it.
023 *
024 * @author jhyde
025 * @version $Id: //open/mondrian-release/3.2/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#1 $
026 * @since Sep 26, 2005
027 */
028 public abstract class AbstractBooleanCalc
029 extends AbstractCalc
030 implements BooleanCalc
031 {
032 /**
033 * Creates an AbstractBooleanCalc.
034 *
035 * @param exp Source expression
036 * @param calcs Child compiled expressions
037 */
038 public AbstractBooleanCalc(Exp exp, Calc[] calcs) {
039 super(exp, calcs);
040 // now supports int and double conversion (see
041 // AbstractExpCompiler.compileBoolean():
042 // assert getType() instanceof BooleanType;
043 }
044
045 public Object evaluate(Evaluator evaluator) {
046 return Boolean.valueOf(evaluateBoolean(evaluator));
047 }
048 }
049
050 // End AbstractBooleanCalc.java