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