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-2010 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.calc;
011
012import mondrian.olap.Parameter;
013
014/**
015 * Implementation of a parameter.
016 *
017 * @author jhyde
018 * @since Jul 25, 2006
019 */
020public interface ParameterSlot {
021    /**
022     * Returns the unique index of the slot.
023     */
024    int getIndex();
025
026    /**
027     * Returns a compiled expression to compute the default value of the
028     * parameter.
029     */
030    Calc getDefaultValueCalc();
031
032    /**
033     * Returns the parameter.
034     */
035    Parameter getParameter();
036
037    /**
038     * Sets the value of this parameter.
039     *
040     * <p>NOTE: This method will be removed when we store parameter values
041     * in the {@link mondrian.olap.Result} rather than in the
042     * {@link mondrian.olap.Query}.
043     *
044     * @param value New value
045     * @param assigned Whether {@link #isParameterSet()} should return true;
046     *   supply value {@code false} if this is an internal assignment, to
047     *   remember the default value
048     */
049    void setParameterValue(Object value, boolean assigned);
050
051    /**
052     * Returns the value of this parameter.
053     *
054     * <p>NOTE: This method will be removed when we store parameter values
055     * in the {@link mondrian.olap.Result} rather than in the
056     * {@link mondrian.olap.Query}.
057     */
058    Object getParameterValue();
059
060    /**
061     * Returns whether the parameter has been assigned a value. (That value
062     * may be null.)
063     *
064     * @return Whether parmaeter has been assigned a value.
065     */
066    boolean isParameterSet();
067
068    void setCachedDefaultValue(Object value);
069
070    Object getCachedDefaultValue();
071
072    /**
073     * Unsets the parameter value.
074     */
075    void unsetParameterValue();
076}
077
078// End ParameterSlot.java