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.HierarchyCalc; 014import mondrian.olap.Evaluator; 015import mondrian.olap.Exp; 016import mondrian.olap.type.HierarchyType; 017 018/** 019 * Abstract implementation of the {@link mondrian.calc.HierarchyCalc} interface. 020 * 021 * <p>The derived class must 022 * implement the {@link #evaluateHierarchy(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 AbstractHierarchyCalc 029 extends AbstractCalc 030 implements HierarchyCalc 031{ 032 /** 033 * Creates an AbstractHierarchyCalc. 034 * 035 * @param exp Source expression 036 * @param calcs Child compiled expressions 037 */ 038 protected AbstractHierarchyCalc(Exp exp, Calc[] calcs) { 039 super(exp, calcs); 040 assert getType() instanceof HierarchyType; 041 } 042 043 public Object evaluate(Evaluator evaluator) { 044 return evaluateHierarchy(evaluator); 045 } 046} 047 048// End AbstractHierarchyCalc.java