001 /* 002 // $Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#4 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2006-2007 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/src/main/mondrian/calc/impl/AbstractBooleanCalc.java#4 $ 026 * @since Sep 26, 2005 027 */ 028 public abstract class AbstractBooleanCalc 029 extends AbstractCalc 030 implements BooleanCalc { 031 private final Calc[] calcs; 032 033 public AbstractBooleanCalc(Exp exp, Calc[] calcs) { 034 super(exp); 035 this.calcs = calcs; 036 // now supports int and double conversion (see AbstractExpCompiler.compileBoolean() 037 // assert getType() instanceof BooleanType; 038 } 039 040 public Object evaluate(Evaluator evaluator) { 041 return Boolean.valueOf(evaluateBoolean(evaluator)); 042 } 043 044 public Calc[] getCalcs() { 045 return calcs; 046 } 047 } 048 049 // End AbstractBooleanCalc.java