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