|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.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 | |
---|---|
protected static class |
RolapEvaluator.RolapEvaluatorRoot
|
Field Summary | |
---|---|
protected List<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 RolapEvaluator.RolapEvaluatorRoot |
root
|
Constructor Summary | |
---|---|
|
RolapEvaluator(RolapEvaluator.RolapEvaluatorRoot root)
Creates an evaluator with no parent. |
protected |
RolapEvaluator(RolapEvaluator.RolapEvaluatorRoot root,
RolapEvaluator parent)
Creates an evaluator. |
Method Summary | |
---|---|
protected RolapEvaluator |
_push()
Creates a clone of the current validator. |
(package private) void |
addCalcMember(Member member)
|
void |
clearExpResultCache(boolean clearValidResult)
|
static Evaluator |
create(Query query)
Creates an evaluator. |
boolean |
equals(Object obj)
Returns true if the other object is a RolapEvaluator with
identical context. |
Object |
evaluateCurrent()
Calculates and returns the value of the cell at the current context. |
Object |
evaluateNamedSet(String name,
Exp exp)
Evaluates a named set. |
String |
format(Object o)
Formats a value as a string according to the current context's format. |
String |
format(Object o,
String formatString)
Formats a value as a string according to the current context's format, using a given format string. |
List<List<Member[]>> |
getAggregationLists()
|
Object |
getCachedResult(ExpCacheDescriptor cacheDescriptor)
Simple caching of the result of an Exp . |
Locale |
getConnectionLocale()
Returns the connection's locale. |
RolapMember |
getContext(Dimension dimension)
|
RolapCube |
getCube()
Returns the current cube. |
int |
getDepth()
Returns number of ancestor evaluators. |
SqlQuery.Dialect |
getDialect()
|
(package private) Member |
getExpanding()
Returns the calculated member being currently expanded. |
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. |
Object |
getParameterValue(ParameterSlot slot)
Returns the value of a parameter, evaluating its default value if it is not set. |
Evaluator |
getParent()
Returns parent evaluator. |
Object |
getProperty(String name,
Object defaultValue)
Retrieves the value of property name . |
Query |
getQuery()
Returns the current query. |
Date |
getQueryStartTime()
Returns the start time of the current query. |
SchemaReader |
getSchemaReader()
Returns a SchemaReader appropriate for the current
access-control context. |
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 |
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. |
RuntimeException |
newEvalException(Object context,
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. |
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. |
Evaluator |
pushAggregation(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 |
setCellReader(CellReader cellReader)
|
void |
setContext(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 |
void |
setIterationLength(int length)
Sets the iteration length for the current evaluator context |
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 RolapEvaluator.RolapEvaluatorRoot root
protected List<List<Member[]>> aggregationLists
Constructor Detail |
---|
protected RolapEvaluator(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(RolapEvaluator.RolapEvaluatorRoot root)
root
- Shared context between this evaluator and its childrenMethod Detail |
---|
public static Evaluator create(Query query)
public RolapCube getMeasureCube()
getMeasureCube
in interface Evaluator
public boolean needToReturnNullForUnrelatedDimension(Member[] members)
needToReturnNullForUnrelatedDimension
in interface Evaluator
members
- dimensions for the members need to be checked whether
related or unrelated
protected final org.apache.log4j.Logger getLogger()
public final Member[] getMembers()
Evaluator
getMembers
in interface Evaluator
public final List<List<Member[]>> getAggregationLists()
final void setCellReader(CellReader cellReader)
public final RolapCube getCube()
Evaluator
getCube
in interface Evaluator
public final Query getQuery()
Evaluator
getQuery
in interface Evaluator
public final int getDepth()
Evaluator
getDepth
in interface Evaluator
public final Evaluator getParent()
Evaluator
getParent
in interface Evaluator
public final SchemaReader getSchemaReader()
Evaluator
SchemaReader
appropriate for the current
access-control context.
getSchemaReader
in interface Evaluator
public Date getQueryStartTime()
Evaluator
getQueryStartTime
in interface Evaluator
public SqlQuery.Dialect getDialect()
public final RolapEvaluator push(Member[] members)
Evaluator
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 Evaluator
members
- Array of members to add to the context
public final RolapEvaluator push(Member member)
Evaluator
push(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 Evaluator
member
- Member to add to the context
public final RolapEvaluator push()
Evaluator
push(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 Evaluator
protected RolapEvaluator _push()
public final Evaluator pop()
Evaluator
pop
in interface Evaluator
public final Evaluator pushAggregation(List<Member[]> list)
Evaluator
pushAggregation
in interface Evaluator
list
- List of tuples
list
added to its aggregation
contextpublic final boolean equals(Object obj)
RolapEvaluator
with
identical context.
equals
in class Object
public final int hashCode()
hashCode
in class Object
public final void setSlicerContext(Member member)
member
- a member in the slicerpublic final List<Member> getSlicerMembers()
public final Member setContext(Member member)
Evaluator
member
the current member of its dimension. Returns
the previous context.
setContext
in interface Evaluator
public final void setContext(List<Member> memberList)
setContext
in interface Evaluator
public final void setContext(Member[] members)
setContext
in interface Evaluator
public final RolapMember getContext(Dimension dimension)
getContext
in interface Evaluator
public final Object evaluateCurrent()
Evaluator
evaluateCurrent
in interface Evaluator
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 Object getProperty(String name, Object defaultValue)
Evaluator
name
. 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 Evaluator
public final String getFormatString()
getFormatString
in interface Evaluator
public final Locale getConnectionLocale()
Evaluator
getConnectionLocale
in interface Evaluator
public final String format(Object o)
Evaluator
format
in interface Evaluator
public final String format(Object o, String formatString)
Evaluator
format
in interface Evaluator
public final Object getCachedResult(ExpCacheDescriptor cacheDescriptor)
Evaluator
Exp
. 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 Evaluator
Calc.dependsOn(mondrian.olap.Dimension)
public final void clearExpResultCache(boolean clearValidResult)
public final boolean isNonEmpty()
Evaluator
May 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 Evaluator
public final void setNonEmpty(boolean nonEmpty)
Evaluator
setNonEmpty
in interface Evaluator
public final RuntimeException newEvalException(Object context, String s)
Evaluator
newEvalException
in interface Evaluator
public final Object evaluateNamedSet(String name, Exp exp)
Evaluator
evaluateNamedSet
in interface Evaluator
public final int getMissCount()
Evaluator
getMissCount
in interface Evaluator
public final Object getParameterValue(ParameterSlot slot)
Evaluator
getParameterValue
in interface Evaluator
final void addCalcMember(Member member)
public final int getIterationLength()
getIterationLength
in interface Evaluator
public final void setIterationLength(int length)
Evaluator
setIterationLength
in interface Evaluator
length
- length to be setpublic final boolean isEvalAxes()
isEvalAxes
in interface Evaluator
public final void setEvalAxes(boolean evalAxes)
Evaluator
setEvalAxes
in interface Evaluator
evalAxes
- 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 |