|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Calc
Calc is the base class for all calculable expressions.
Exp).
Calc).
<Member>.CurrentMember function) are made
explicit in the physical language.
ExpCompiler). There are often more than one evaluation strategy
for a given expression, and compilation process gives us an opportunity to
choose the optimal one.
Calc interface has sub-interfaces for various types:
IntegerCalc,
BooleanCalc,
DoubleCalc,
StringCalc are scalar expressions;
MemberCalc,
LevelCalc,
HierarchyCalc,
DimensionCalc yield elements of the OLAP model.
Each of these sub-interfaces has an abstract implementation:
AbstractIntegerCalc,
AbstractBooleanCalc,
AbstractDoubleCalc,
AbstractStringCalc,
AbstractMemberCalc,
AbstractLevelCalc,
AbstractHierarchyCalc,
AbstractDimensionCalc.
GenericCalc is an adapter which implements all of these interfaces
and will try to convert any given result to the correct type. Use it
sparingly: if you know the expected result type, it is better to write a
class which implements a specific TypeCalc interface.

| Method Summary | |
|---|---|
void |
accept(CalcWriter calcWriter)
Prints this expression, by accepting a visiting CalcWriter. |
boolean |
dependsOn(Dimension dimension)
Returns whether this expression depends upon a given dimension. |
Object |
evaluate(Evaluator evaluator)
Evaluates this expression. |
ResultStyle |
getResultStyle()
Returns style in which the result of evaluating this expression is returned. |
Type |
getType()
Returns the type of this expression. |
| Method Detail |
|---|
Object evaluate(Evaluator evaluator)
evaluator - Provides dimensional context in which to evaluate
this expression
boolean dependsOn(Dimension dimension)
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.
dimension - Dimension
Type getType()
void accept(CalcWriter calcWriter)
CalcWriter.
calcWriter - WriterResultStyle getResultStyle()
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.
ExpCompiler.compileList(mondrian.olap.Exp, boolean)
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||