001    /*
002    // $Id: //open/mondrian-release/3.2/src/main/mondrian/calc/impl/AbstractHierarchyCalc.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.HierarchyType;
015    import mondrian.calc.HierarchyCalc;
016    import mondrian.calc.Calc;
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     * @version $Id: //open/mondrian-release/3.2/src/main/mondrian/calc/impl/AbstractHierarchyCalc.java#1 $
027     * @since Sep 26, 2005
028     */
029    public abstract class AbstractHierarchyCalc
030        extends AbstractCalc
031        implements HierarchyCalc
032    {
033        /**
034         * Creates an AbstractHierarchyCalc.
035         *
036         * @param exp Source expression
037         * @param calcs Child compiled expressions
038         */
039        protected AbstractHierarchyCalc(Exp exp, Calc[] calcs) {
040            super(exp, calcs);
041            assert getType() instanceof HierarchyType;
042        }
043    
044        public Object evaluate(Evaluator evaluator) {
045            return evaluateHierarchy(evaluator);
046        }
047    }
048    
049    // End AbstractHierarchyCalc.java