mondrian.olap
Interface Evaluator

All Known Implementing Classes:
RolapDependencyTestingEvaluator, RolapEvaluator

public interface Evaluator

An Evaluator holds the context necessary to evaluate an expression.

Since:
27 July, 2001
Author:
jhyde
 

Method Summary
 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.
 Object getCachedResult(ExpCacheDescriptor key)
          Simple caching of the result of an Exp.
 Locale getConnectionLocale()
          Returns the connection's locale.
 Member getContext(Dimension dimension)
           
 Cube getCube()
          Returns the current cube.
 int getDepth()
          Returns number of ancestor evaluators.
 String getFormatString()
          Returns the format string for this cell.
 int getIterationLength()
           
 Cube 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.
 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.
 Evaluator push()
          Creates a new Evaluator with the same context as this evaluator.
 Evaluator push(Member member)
          Creates a new Evaluator with the same context except for one member.
 Evaluator 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.
 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.
 boolean shouldIgnoreUnrelatedDimensions()
          Checks if unrelated dimensions to the measure in the current context should be ignored
 

Method Detail

getCube

Cube getCube()
Returns the current cube.


getQuery

Query getQuery()
Returns the current query.


getQueryStartTime

Date getQueryStartTime()
Returns the start time of the current query.


push

Evaluator push(Member[] members)
Creates a new Evaluator with each given member overriding the context of the current Evaluator for its dimension. Other dimensions retain the same context as this Evaluator.

You can retrieve this Evaluator by calling the new Evaluator's pop() method, but it is not necessary to call pop.

Parameters:
members - Array of members to add to the context
Returns:
Evaluator with each given member overriding the state of the current Evaluator for its dimension

push

Evaluator push()
Creates a new Evaluator with the same context as this evaluator. Equivalent to 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 pop() method, but it is not necessary to call pop.

Returns:
Evaluator with each given member overriding the state of the current Evaluator for its dimension

push

Evaluator push(Member member)
Creates a new Evaluator with the same context except for one member. Equivalent to push(new Member[] |member}).

You can retrieve this Evaluator by calling the new Evaluator's pop() method, but it is not necessary to call pop.

Parameters:
member - Member to add to the context
Returns:
Evaluator with each given member overriding the state of the current Evaluator for its dimension

pop

Evaluator pop()
Restores previous evaluator.


setContext

Member setContext(Member member)
Makes member the current member of its dimension. Returns the previous context.

Pre-condition:
member != null
Post-condition:
return != null

setContext

void setContext(List<Member> memberList)

setContext

void setContext(Member[] members)

getContext

Member getContext(Dimension dimension)

evaluateCurrent

Object evaluateCurrent()
Calculates and returns the value of the cell at the current context.


getFormatString

String getFormatString()
Returns the format string for this cell. This is computed by evaluating the format expression in the current context, and therefore different cells may have different format strings.


format

String format(Object o)
Formats a value as a string according to the current context's format.


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.


getDepth

int getDepth()
Returns number of ancestor evaluators. Used to check for infinite loops.

Post-condition:
return getParent() == null ? 0 : getParent().getDepth() + 1

getParent

Evaluator getParent()
Returns parent evaluator.


getConnectionLocale

Locale getConnectionLocale()
Returns the connection's locale.


getProperty

Object getProperty(String name,
                   Object defaultValue)
Retrieves the value of property 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.


getSchemaReader

SchemaReader getSchemaReader()
Returns a SchemaReader appropriate for the current access-control context.


getCachedResult

Object getCachedResult(ExpCacheDescriptor key)
Simple caching of the result of an 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.

See Also:
Calc.dependsOn(mondrian.olap.Dimension)

isNonEmpty

boolean isNonEmpty()
Returns true for an axis that is NON EMPTY.

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));


setNonEmpty

void setNonEmpty(boolean nonEmpty)
Sets whether an expression evaluation should filter out empty cells. Allows expressions to modify non empty flag to evaluate their children.


newEvalException

RuntimeException newEvalException(Object context,
                                  String s)
Creates an exception which indicates that an error has occurred during the runtime evaluation of a function. The caller should then throw that exception.


evaluateNamedSet

Object evaluateNamedSet(String name,
                        Exp exp)
Evaluates a named set.


getMembers

Member[] getMembers()
Returns an array of the members which make up the current context.


getMissCount

int getMissCount()
Returns the number of times that this evaluator has told a lie when retrieving cell values.


getParameterValue

Object getParameterValue(ParameterSlot slot)
Returns the value of a parameter, evaluating its default value if it is not set.


getIterationLength

int getIterationLength()
Returns:
the iteration length of the current context

setIterationLength

void setIterationLength(int length)
Sets the iteration length for the current evaluator context

Parameters:
length - length to be set

isEvalAxes

boolean isEvalAxes()
Returns:
true if evaluating axes

setEvalAxes

void setEvalAxes(boolean evalAxes)
Indicate whether the evaluator is evaluating the axes

Parameters:
evalAxes - true if evaluating axes

pushAggregation

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.

Parameters:
list - List of tuples
Returns:
Aggregator with list added to its aggregation context

shouldIgnoreUnrelatedDimensions

boolean shouldIgnoreUnrelatedDimensions()
Checks if unrelated dimensions to the measure in the current context should be ignored

Returns:
boolean

getMeasureCube

Cube getMeasureCube()
Returns the base (non-virtual) cube that the current measure in the context belongs to.

Returns:
Cube

needToReturnNullForUnrelatedDimension

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.

Parameters:
members - dimensions for the members need to be checked whether related or unrelated
Returns:
boolean

SourceForge.net_Logo