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