001    /*
002    // $Id: //open/mondrian/src/main/mondrian/rolap/CellReader.java#13 $
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) 2001-2002 Kana Software, Inc.
007    // Copyright (C) 2001-2008 Julian Hyde and others
008    // All Rights Reserved.
009    // You must accept the terms of that agreement to use this software.
010    //
011    // jhyde, 10 August, 2001
012    */
013    
014    package mondrian.rolap;
015    import mondrian.olap.Evaluator;
016    import mondrian.olap.Util;
017    import mondrian.olap.Member;
018    
019    import java.util.List;
020    
021    /**
022     * A <code>CellReader</code> finds the cell value for the current context
023     * held by <code>evaluator</code>.
024     *
025     * <p>It returns:<ul>
026     * <li><code>null</code> if the source is unable to evaluate the cell (for
027     *   example, <code>AggregatingCellReader</code> does not have the cell
028     *   in its cache). This value should only be returned if the caller is
029     *   expecting it.</li>
030     * <li>{@link Util#nullValue} if the cell evaluates to null</li>
031     * <li>{@link mondrian.olap.Util.ErrorCellValue} if the cell evaluates to an
032     *   error</li>
033     * <li>an Object representing a value (often a {@link Double} or a {@link
034     *   java.math.BigDecimal}), otherwise</li>
035     * </ul>
036     *
037     * @author jhyde
038     * @since 10 August, 2001
039     * @version $Id: //open/mondrian/src/main/mondrian/rolap/CellReader.java#13 $
040     */
041    interface CellReader {
042        /**
043         * Returns the value of the cell which has the context described by the
044         * evaluator.
045         * A cell could have optional compound member coordinates usually specified
046         * using the Aggregate function. These compound members are contained in the
047         * evaluator.
048         *
049         * <p>If no aggregation contains the required cell, returns null.
050         *
051         * <p>If the value is null, returns {@link Util#nullValue}.
052         *
053         * @return Cell value, or null if not found, or {@link Util#nullValue} if
054         * the value is null
055         */
056        Object get(RolapEvaluator evaluator);
057    
058        /**
059         * Returns the number of times this cell reader has told a lie (since creation),
060         * because the required cell value is not in the cache.
061         */
062        int getMissCount();
063    
064        /**
065         * @return whether thus cell reader has any pending cell requests that are
066         * not loaded yet.
067         */
068        boolean isDirty();
069    }
070    
071    // End CellReader.java