mondrian.calc.impl
Class AbstractMemberListCalc

java.lang.Object
  extended by mondrian.calc.impl.AbstractCalc
      extended by mondrian.calc.impl.AbstractMemberListCalc
All Implemented Interfaces:
Calc, ListCalc, MemberListCalc

public abstract class AbstractMemberListCalc
extends AbstractCalc
implements MemberListCalc

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 MemberListCalc.evaluateMemberList(mondrian.olap.Evaluator) method, and the evaluate(mondrian.olap.Evaluator) method will call it.

Since:
Feb 20, 2008
Author:
jhyde
See Also:
AbstractListCalc
 

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

Constructor Detail

AbstractMemberListCalc

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

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

AbstractMemberListCalc

protected AbstractMemberListCalc(Exp exp,
                                 Calc[] calcs,
                                 boolean mutable)
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)
mutable - Whether the list is mutable
Method Detail

evaluate

public 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

getCalcs

public Calc[] getCalcs()
Description copied from class: AbstractCalc
Returns this expression's child expressions.

Specified by:
getCalcs in class AbstractCalc

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 String toString()
Overrides:
toString in class Object

evaluateList

public List<Member> evaluateList(Evaluator evaluator)
Description copied from interface: ListCalc
Evaluates an expression to yield a list of members or tuples.

The list is immutable if Calc.getResultStyle() yields ResultStyle.MUTABLE_LIST. Otherwise, the caller must not modify the list.

Specified by:
evaluateList in interface ListCalc
Parameters:
evaluator - Evaluation context
Returns:
A list of members or tuples, never null.

evaluateTupleList

public List<Member[]> evaluateTupleList(Evaluator evaluator)

SourceForge.net_Logo