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) 2009-2011 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.rolap; 011 012import mondrian.calc.Calc; 013 014/** 015 * Entry in the evaluation context that indicates a calculation that needs to 016 * be performed before we get to the atomic stored cells. 017 * 018 * <p>Most of the time it's just members that are calculated, but calculated 019 * tuples arise when the slicer is a set of tuples. 020 * 021 * <p>The evaluator uses this interface to efficiently expand a member or tuple 022 * from the evaluation context. When evaluated, a calculation will change one or 023 * more elements of the context (calculated members just change one, but tuple 024 * sets in the slicer can change more than one). 025 * 026 * @author jhyde 027 * @since May 15, 2009 028 */ 029interface RolapCalculation { 030 /** 031 * Pushes this calculated member or tuple onto the stack of evaluation 032 * contexts, and sets the context to the default member of the hierarchy. 033 * 034 * @param evaluator Evaluator 035 */ 036 void setContextIn(RolapEvaluator evaluator); 037 038 /** 039 * Returns the solve order of this calculation. Identifies which order 040 * calculations are expanded. 041 * 042 * @return Solve order 043 */ 044 int getSolveOrder(); 045 046 /** 047 * Returns the ordinal of this calculation; to resolve ties. 048 * 049 * @return Ordinal or calculation 050 */ 051 int getHierarchyOrdinal(); 052 053 /** 054 * Returns whether this calculation is a member is computed from a 055 * {@code WITH MEMBER} clause in an MDX query. 056 * 057 * @return whether this calculation is computed in an MDX query 058 */ 059 boolean isCalculatedInQuery(); 060 061 /** 062 * Returns the compiled expression to evaluate the scalar value of the 063 * current cell. This method will be called frequently, so the 064 * implementation should probably compile once and cache the result. 065 * 066 * @param root Root evaluation context 067 * @return Compiled scalar expression 068 */ 069 Calc getCompiledExpression(RolapEvaluatorRoot root); 070 071 /** 072 * Returns whether this calculation contains an aggregate function. 073 * 074 * @return Whether this calculation contains an aggregate function. 075 */ 076 boolean containsAggregateFunction(); 077} 078 079// End RolapCalculation.java