001 /* 002 // $Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractDimensionCalc.java#3 $ 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-2008 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.DimensionType; 015 import mondrian.calc.impl.AbstractCalc; 016 import mondrian.calc.DimensionCalc; 017 import mondrian.calc.Calc; 018 019 /** 020 * Abstract implementation of the {@link mondrian.calc.DimensionCalc} interface. 021 * 022 * <p>The derived class must 023 * implement the {@link #evaluateDimension(mondrian.olap.Evaluator)} method, 024 * and the {@link #evaluate(mondrian.olap.Evaluator)} method will call it. 025 * 026 * @author jhyde 027 * @version $Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractDimensionCalc.java#3 $ 028 * @since Sep 26, 2005 029 */ 030 public abstract class AbstractDimensionCalc 031 extends AbstractCalc implements DimensionCalc { 032 private final Calc[] calcs; 033 034 protected AbstractDimensionCalc(Exp exp, Calc[] calcs) { 035 super(exp); 036 this.calcs = calcs; 037 assert getType() instanceof DimensionType; 038 } 039 040 public Object evaluate(Evaluator evaluator) { 041 return evaluateDimension(evaluator); 042 } 043 044 public Calc[] getCalcs() { 045 return calcs; 046 } 047 } 048 049 // End AbstractDimensionCalc.java