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