|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.calc.impl.AbstractCalc
public abstract class AbstractCalc
Abstract implementation of the Calc
interface.
Field Summary | |
---|---|
protected Exp |
exp
|
protected Type |
type
|
Constructor Summary | |
---|---|
protected |
AbstractCalc(Exp exp)
|
Method Summary | |
---|---|
void |
accept(CalcWriter calcWriter)
Prints this expression, by accepting a visiting CalcWriter . |
static boolean |
anyDepends(Calc[] calcs,
Dimension dimension)
Returns true if one of the calcs depends on the given dimension. |
static boolean |
anyDependsButFirst(Calc[] calcs,
Dimension dimension)
Returns true if calc[0] depends on dimension, else false if calc[0] returns dimension, else true if any of the other calcs depend on dimension. |
static boolean |
butDepends(Calc[] calcs,
Dimension dimension)
Returns true if any of the calcs depend on dimension, else false if any of the calcs return dimension, else true. |
boolean |
dependsOn(Dimension dimension)
Returns whether this expression depends upon a given dimension. |
List<Object> |
getArguments()
Returns any other arguments to this calc. |
abstract Calc[] |
getCalcs()
Returns this expression's child expressions. |
protected String |
getName()
Returns the name of this expression type, used when serializing an expression to a string. |
ResultStyle |
getResultStyle()
Returns style in which the result of evaluating this expression is returned. |
Type |
getType()
Returns the type of this expression. |
static Evaluator |
simplifyEvaluator(Calc calc,
Evaluator evaluator)
Returns a simplified evalator whose context is the same for every dimension which an expression depends on, and the default member for every dimension which it does not depend on. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface mondrian.calc.Calc |
---|
evaluate |
Field Detail |
---|
protected final Type type
protected final Exp exp
Constructor Detail |
---|
protected AbstractCalc(Exp exp)
Method Detail |
---|
public Type getType()
Calc
getType
in interface Calc
public void accept(CalcWriter calcWriter)
Calc
CalcWriter
.
accept
in interface Calc
calcWriter
- Writerprotected String getName()
The default implementation tries to extract a name from a function call, if any, then prints the last part of the class name.
public abstract Calc[] getCalcs()
public boolean dependsOn(Dimension dimension)
Calc
If it does not depend on the dimension, then re-evaluating the expression with a different member of this context must produce the same answer.
Some examples:[Measures].[Unit Sales]
depends on all dimensions except [Measures]
.
([Measures].[Unit Sales],
[Time].[1997]) > 1000
depends on all dimensions except [Measures] and [Time].
Filter([Store].[USA].Children,
[Measures].[Unit Sales] < 50)
depends upon all dimensions except [Store] and [Measures].
How so? Normally the scalar expression would depend upon all dimensions
except [Measures], but the Filter
function sets the [Store]
context before evaluating the scalar expression, so it is not inherited
from the surrounding context.
dependsOn
in interface Calc
dimension
- Dimension
public static boolean anyDepends(Calc[] calcs, Dimension dimension)
public static boolean anyDependsButFirst(Calc[] calcs, Dimension dimension)
Typical application: Aggregate({Set}, {Value Expression})
depends upon everything {Value Expression} depends upon, except the
dimensions of {Set}.
public static boolean butDepends(Calc[] calcs, Dimension dimension)
public List<Object> getArguments()
public static Evaluator simplifyEvaluator(Calc calc, Evaluator evaluator)
The default member is often the 'all' member, so this evaluator is usually the most efficient context in which to evaluate the expression.
calc
- evaluator
- public ResultStyle getResultStyle()
Calc
One application of this method is for the compiler to figure out whether the compiled expression is returning a mutable list. If a mutable list is required, the compiler can create a mutable copy.
getResultStyle
in interface Calc
ExpCompiler.compileList(mondrian.olap.Exp, boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |