mondrian.calc.impl
Class AbstractMemberIterCalc

java.lang.Object
  extended by mondrian.calc.impl.AbstractCalc
      extended by mondrian.calc.impl.AbstractMemberIterCalc
All Implemented Interfaces:
Calc, IterCalc, MemberIterCalc
Direct Known Subclasses:
SetFunDef.ExprMemberIterCalc

public abstract class AbstractMemberIterCalc
extends AbstractCalc
implements MemberIterCalc

Abstract implementation of the ListCalc interface for expressions that return a list of members but never a list of tuples.

The derived class must implement the MemberIterCalc.evaluateMemberIterable(mondrian.olap.Evaluator) method, and the evaluate(mondrian.olap.Evaluator) method will call it.

Since:
Oct 24, 2008
Version:
$Id: //open/mondrian/src/main/mondrian/calc/impl/AbstractMemberIterCalc.java#3 $
Author:
jhyde
See Also:
AbstractListCalc

Field Summary
 
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type
 
Constructor Summary
protected AbstractMemberIterCalc(Exp exp, Calc[] calcs)
          Creates an abstract implementation of a compiled expression which returns a list.
 
Method Summary
 java.lang.Object evaluate(Evaluator evaluator)
          Evaluates this expression.
 java.lang.Iterable<Member> evaluateIterable(Evaluator evaluator)
          Evaluates an expression to yield an Iterable of members or tuples.
 ResultStyle getResultStyle()
          Returns style in which the result of evaluating this expression is returned.
 SetType getType()
          Returns the type of this expression.
 java.lang.String toString()
           
 
Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, dependsOn, getArguments, getCalcs, getName, simplifyEvaluator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mondrian.calc.MemberIterCalc
evaluateMemberIterable
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn
 

Constructor Detail

AbstractMemberIterCalc

protected AbstractMemberIterCalc(Exp exp,
                                 Calc[] calcs)
Creates an abstract implementation of a compiled expression which returns a list.

Parameters:
exp - Expression which was compiled
calcs - List of child compiled expressions (for dependency analysis)
Method Detail

getType

public SetType getType()
Description copied from interface: Calc
Returns the type of this expression.

Specified by:
getType in interface Calc
Specified by:
getType in interface MemberIterCalc
Overrides:
getType in class AbstractCalc

evaluate

public final java.lang.Object evaluate(Evaluator evaluator)
Description copied from interface: Calc
Evaluates this expression.

Specified by:
evaluate in interface Calc
Parameters:
evaluator - Provides dimensional context in which to evaluate this expression
Returns:
Result of expression evaluation

getResultStyle

public ResultStyle getResultStyle()
Description copied from interface: Calc
Returns style in which the result of evaluating this expression is returned.

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.

Specified by:
getResultStyle in interface Calc
Overrides:
getResultStyle in class AbstractCalc
See Also:
ExpCompiler.compileList(mondrian.olap.Exp, boolean)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

evaluateIterable

public java.lang.Iterable<Member> evaluateIterable(Evaluator evaluator)
Description copied from interface: IterCalc
Evaluates an expression to yield an Iterable of members or tuples.

The Iterable is immutable.

Specified by:
evaluateIterable in interface IterCalc
Parameters:
evaluator - Evaluation context
Returns:
An Iterable of members or tuples, never null.

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads