|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmondrian.rolap.RolapEvaluator
public class RolapEvaluator
RolapEvaluator evaluates expressions in a dimensional
environment.
The context contains a member (which may be the default member)
for every dimension in the current cube. Certain operations, such as
evaluating a calculated member or a tuple, change the current context. The
evaluator's push(mondrian.olap.Member[]) method creates a clone of the current evaluator
so that you can revert to the original context once the operation has
completed.
Many of the methods in this class are performance-critical. Where possible they are declared 'final' so that the JVM can optimize calls to these methods. If future functionality requires it, the 'final' modifier can be removed and these methods can be overridden.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface mondrian.olap.Evaluator |
|---|
Evaluator.NamedSetEvaluator |
| Field Summary | |
|---|---|
protected java.util.List<java.util.List<Member[]>> |
aggregationLists
List of lists of tuples or members, rarely used, but overrides the ordinary dimensional context if set when a cell value comes to be evaluated. |
protected CellReader |
cellReader
|
protected RolapEvaluatorRoot |
root
|
| Constructor Summary | |
|---|---|
|
RolapEvaluator(RolapEvaluatorRoot root)
Creates an evaluator with no parent. |
protected |
RolapEvaluator(RolapEvaluatorRoot root,
RolapEvaluator parent)
Creates an evaluator. |
| Method Summary | |
|---|---|
protected RolapEvaluator |
_push()
Creates a clone of the current validator. |
(package private) void |
addCalcMember(RolapCalculation member)
|
void |
clearExpResultCache(boolean clearValidResult)
|
static Evaluator |
create(Query query)
Creates an evaluator. |
boolean |
equals(java.lang.Object obj)
Returns true if the other object is a RolapEvaluator with
identical context. |
java.lang.Object |
evaluateCurrent()
Calculates and returns the value of the cell at the current context. |
java.lang.String |
format(java.lang.Object o)
Formats a value as a string according to the current context's format. |
java.lang.String |
format(java.lang.Object o,
java.lang.String formatString)
Formats a value as a string according to the current context's format, using a given format string. |
java.util.List<java.util.List<Member[]>> |
getAggregationLists()
|
java.lang.Object |
getCachedResult(ExpCacheDescriptor cacheDescriptor)
Simple caching of the result of an Exp. |
java.util.Locale |
getConnectionLocale()
Returns the connection's locale. |
RolapMember |
getContext(Hierarchy hierarchy)
|
RolapMember |
getContext(RolapHierarchy hierarchy)
More specific version of getContext(mondrian.olap.Hierarchy),
for internal code. |
RolapCube |
getCube()
Returns the current cube. |
int |
getDepth()
Returns number of ancestor evaluators. |
Dialect |
getDialect()
|
(package private) Member |
getExpanding()
Returns the calculated member being currently expanded. |
java.lang.String |
getFormatString()
Returns the format string for this cell. |
int |
getIterationLength()
|
protected org.apache.log4j.Logger |
getLogger()
|
RolapCube |
getMeasureCube()
Returns the base (non-virtual) cube that the current measure in the context belongs to. |
Member[] |
getMembers()
Returns an array of the members which make up the current context. |
int |
getMissCount()
Returns the number of times that this evaluator has told a lie when retrieving cell values. |
Evaluator.NamedSetEvaluator |
getNamedSetEvaluator(NamedSet namedSet,
boolean create)
Returns an evaluator for a named set. |
java.lang.Object |
getParameterValue(ParameterSlot slot)
Returns the value of a parameter, evaluating its default value if it is not set. |
Evaluator |
getParent()
Returns parent evaluator. |
java.lang.Object |
getProperty(java.lang.String name,
java.lang.Object defaultValue)
Retrieves the value of property name. |
Query |
getQuery()
Returns the current query. |
java.util.Date |
getQueryStartTime()
Returns the start time of the current query. |
SchemaReader |
getSchemaReader()
Returns a SchemaReader appropriate for the current
access-control context. |
java.util.List<Member> |
getSlicerMembers()
Return the list of slicer members in the current evaluator context. |
int |
hashCode()
|
boolean |
isEvalAxes()
|
boolean |
isNonEmpty()
Returns true for an axis that is NON EMPTY. |
boolean |
nativeEnabled()
indicates whether native evaluation is enabled in this context |
boolean |
needToReturnNullForUnrelatedDimension(Member[] members)
If IgnoreMeasureForNonJoiningDimension is set to true and one or more members are on unrelated dimension for the measure in current context then returns true. |
java.lang.RuntimeException |
newEvalException(java.lang.Object context,
java.lang.String s)
Creates an exception which indicates that an error has occurred during the runtime evaluation of a function. |
Evaluator |
pop()
Restores previous evaluator. |
RolapEvaluator |
push()
Creates a new Evaluator with the same context as this evaluator. |
Evaluator |
push(boolean nonEmpty)
Creates a new evaluator with the same state except nonEmpty property. |
Evaluator |
push(boolean nonEmpty,
boolean nativeEnabled)
Creates a new evaluator with the same state except nonEmpty and nativeEnabled properties. |
RolapEvaluator |
push(Member member)
Creates a new Evaluator with the same context except for one member. |
RolapEvaluator |
push(Member[] members)
Creates a new Evaluator with each given member overriding the context of the current Evaluator for its dimension. |
RolapEvaluator |
push(RolapCalculation calc)
|
Evaluator |
pushAggregation(java.util.List<Member[]> list)
Returns a new Aggregator whose aggregation context adds a given list of tuples, and whose dimensional context is the same as this Aggregator. |
(package private) void |
removeCalcMember(RolapCalculation previous)
|
(package private) void |
setCellReader(CellReader cellReader)
|
void |
setContext(java.util.List<Member> memberList)
|
Member |
setContext(Member member)
Makes member the current member of its dimension. |
void |
setContext(Member[] members)
|
void |
setEvalAxes(boolean evalAxes)
Indicate whether the evaluator is evaluating the axes |
(package private) void |
setExpanding(Member member)
|
void |
setIterationLength(int length)
Sets the iteration length for the current evaluator context |
void |
setNativeEnabled(java.lang.Boolean nativeEnabled)
|
void |
setNonEmpty(boolean nonEmpty)
Sets whether an expression evaluation should filter out empty cells. |
void |
setSlicerContext(Member member)
Adds a slicer member to the evaluator context, and remember it as part of the slicer. |
boolean |
shouldIgnoreUnrelatedDimensions()
Checks if unrelated dimensions to the measure in the current context should be ignored. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CellReader cellReader
protected final RolapEvaluatorRoot root
protected java.util.List<java.util.List<Member[]>> aggregationLists
| Constructor Detail |
|---|
protected RolapEvaluator(RolapEvaluatorRoot root,
RolapEvaluator parent)
root - Root context for stack of evaluators (contains information
which does not change during the evaluation)parent - Parent evaluator, or null if this is the rootpublic RolapEvaluator(RolapEvaluatorRoot root)
root - Shared context between this evaluator and its children| Method Detail |
|---|
public static Evaluator create(Query query)
public RolapCube getMeasureCube()
getMeasureCube in interface Evaluatorpublic boolean needToReturnNullForUnrelatedDimension(Member[] members)
needToReturnNullForUnrelatedDimension in interface Evaluatormembers - dimensions for the members need to be checked whether
related or unrelated
public boolean nativeEnabled()
Evaluator
nativeEnabled in interface Evaluatorpublic void setNativeEnabled(java.lang.Boolean nativeEnabled)
setNativeEnabled in interface EvaluatornativeEnabled - indicates if native evaluation should be usedprotected final org.apache.log4j.Logger getLogger()
public final Member[] getMembers()
Evaluator
getMembers in interface Evaluatorpublic final java.util.List<java.util.List<Member[]>> getAggregationLists()
final void setCellReader(CellReader cellReader)
public final RolapCube getCube()
Evaluator
getCube in interface Evaluatorpublic final Query getQuery()
Evaluator
getQuery in interface Evaluatorpublic final int getDepth()
Evaluator
getDepth in interface Evaluatorpublic final Evaluator getParent()
Evaluator
getParent in interface Evaluatorpublic final SchemaReader getSchemaReader()
EvaluatorSchemaReader appropriate for the current
access-control context.
getSchemaReader in interface Evaluatorpublic java.util.Date getQueryStartTime()
Evaluator
getQueryStartTime in interface Evaluatorpublic Dialect getDialect()
public final RolapEvaluator push(Member[] members)
EvaluatorYou can retrieve this Evaluator by calling the new Evaluator's
Evaluator.pop() method, but it is not necessary to call pop.
push in interface Evaluatormembers - Array of members to add to the context
public final RolapEvaluator push(Member member)
Evaluatorpush(new Member[] |member}).
You can retrieve this Evaluator by calling the new Evaluator's
Evaluator.pop() method, but it is not necessary to call pop.
push in interface Evaluatormember - Member to add to the context
public Evaluator push(boolean nonEmpty)
Evaluator
push in interface Evaluator
public Evaluator push(boolean nonEmpty,
boolean nativeEnabled)
Evaluator
push in interface Evaluatorpublic final RolapEvaluator push()
Evaluatorpush(new Member[0]).
This method is typically called before evaluating an expression which is known to corrupt the evaluation context.
You can retrieve this Evaluator by calling the new Evaluator's
Evaluator.pop() method, but it is not necessary to call pop.
push in interface Evaluatorpublic RolapEvaluator push(RolapCalculation calc)
protected RolapEvaluator _push()
public final Evaluator pop()
Evaluator
pop in interface Evaluatorpublic final Evaluator pushAggregation(java.util.List<Member[]> list)
Evaluator
pushAggregation in interface Evaluatorlist - List of tuples
list added to its aggregation
contextpublic final boolean equals(java.lang.Object obj)
RolapEvaluator with
identical context.
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final void setSlicerContext(Member member)
member - a member in the slicerpublic final java.util.List<Member> getSlicerMembers()
public final Member setContext(Member member)
Evaluatormember the current member of its dimension. Returns
the previous context.
setContext in interface Evaluatorpublic final void setContext(java.util.List<Member> memberList)
setContext in interface Evaluatorpublic final void setContext(Member[] members)
setContext in interface Evaluatorpublic final RolapMember getContext(Hierarchy hierarchy)
getContext in interface Evaluatorpublic final RolapMember getContext(RolapHierarchy hierarchy)
getContext(mondrian.olap.Hierarchy),
for internal code.
hierarchy - Hierarchy
public final java.lang.Object evaluateCurrent()
Evaluator
evaluateCurrent in interface Evaluatorvoid setExpanding(Member member)
Member getExpanding()
This can be useful if many calculated members are generated with
essentially the same expression. The compiled expression can call this
method to find which instance of the member is current, and therefore the
calculated members can share the same Calc object.
public final java.lang.Object getProperty(java.lang.String name,
java.lang.Object defaultValue)
Evaluatorname. If more than one
member in the current context defines that property, the one with the
highest solve order has precedence.
If the property is not defined, default value is returned.
getProperty in interface Evaluatorpublic final java.lang.String getFormatString()
getFormatString in interface Evaluatorpublic final java.util.Locale getConnectionLocale()
Evaluator
getConnectionLocale in interface Evaluatorpublic final java.lang.String format(java.lang.Object o)
Evaluator
format in interface Evaluator
public final java.lang.String format(java.lang.Object o,
java.lang.String formatString)
Evaluator
format in interface Evaluatorpublic final java.lang.Object getCachedResult(ExpCacheDescriptor cacheDescriptor)
EvaluatorExp. The
key for the cache consists of all members of the current
context that exp depends on. Members of
independent dimensions are not part of the key.
getCachedResult in interface EvaluatorCalc.dependsOn(mondrian.olap.Hierarchy)public final void clearExpResultCache(boolean clearValidResult)
public final boolean isNonEmpty()
EvaluatorMay be used by expression evaluators to optimize their result. For example, a top-level crossjoin may be optimized by removing all non-empty set elements before performing the crossjoin. This is possible because of the identity
nonempty(crossjoin(a, b)) ==
nonempty(crossjoin(nonempty(a), nonempty(b));
isNonEmpty in interface Evaluatorpublic final void setNonEmpty(boolean nonEmpty)
Evaluator
setNonEmpty in interface Evaluator
public final java.lang.RuntimeException newEvalException(java.lang.Object context,
java.lang.String s)
Evaluator
newEvalException in interface Evaluator
public final Evaluator.NamedSetEvaluator getNamedSetEvaluator(NamedSet namedSet,
boolean create)
Evaluator
getNamedSetEvaluator in interface EvaluatornamedSet - Named setcreate - Whether to create evaluator if not found
public final int getMissCount()
Evaluator
getMissCount in interface Evaluatorpublic final java.lang.Object getParameterValue(ParameterSlot slot)
Evaluator
getParameterValue in interface Evaluatorfinal void addCalcMember(RolapCalculation member)
void removeCalcMember(RolapCalculation previous)
public final int getIterationLength()
getIterationLength in interface Evaluatorpublic final void setIterationLength(int length)
Evaluator
setIterationLength in interface Evaluatorlength - length to be setpublic final boolean isEvalAxes()
isEvalAxes in interface Evaluatorpublic final void setEvalAxes(boolean evalAxes)
Evaluator
setEvalAxes in interface EvaluatorevalAxes - true if evaluating axespublic boolean shouldIgnoreUnrelatedDimensions()
shouldIgnoreUnrelatedDimensions in interface Evaluator
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||