mondrian.calc.impl
Class GenericIterCalc

java.lang.Object
  extended by mondrian.calc.impl.AbstractCalc
      extended by mondrian.calc.impl.GenericIterCalc
All Implemented Interfaces:
Calc, IterCalc, ListCalc, MemberIterCalc, MemberListCalc, TupleIterCalc, TupleListCalc

public abstract class GenericIterCalc
extends AbstractCalc
implements ListCalc, MemberListCalc, TupleListCalc, IterCalc, TupleIterCalc, MemberIterCalc

Adapter which computes a set expression and converts it to any list or iterable type.

Since:
Nov 7, 2008
Version:
$Id: //open/mondrian/src/main/mondrian/calc/impl/GenericIterCalc.java#3 $
Author:
jhyde

Field Summary
 
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type
 
Constructor Summary
protected GenericIterCalc(Exp exp)
          Creates a GenericIterCalc without specifying child calculated expressions.
protected GenericIterCalc(Exp exp, Calc[] calcs)
          Creates an GenericIterCalc.
 
Method Summary
 java.lang.Iterable evaluateIterable(Evaluator evaluator)
          Evaluates an expression to yield an Iterable of members or tuples.
 java.util.List evaluateList(Evaluator evaluator)
          Evaluates an expression to yield a list of members or tuples.
 java.lang.Iterable<Member> evaluateMemberIterable(Evaluator evaluator)
          Evaluates an expression to yield a member iterator.
 java.util.List<Member> evaluateMemberList(Evaluator evaluator)
          Evaluates an expression to yield a list of members.
 java.lang.Iterable<Member[]> evaluateTupleIterable(Evaluator evaluator)
          Evaluates an expression to yield an iterator over tuples (arrays of members).
 java.util.List<Member[]> evaluateTupleList(Evaluator evaluator)
          Evaluates an expression to yield a list of tuples.
 SetType getType()
          Returns the type of this expression.
 
Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, dependsOn, getArguments, getCalcs, getName, getResultStyle, simplifyEvaluator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle
 

Constructor Detail

GenericIterCalc

protected GenericIterCalc(Exp exp)
Creates a GenericIterCalc without specifying child calculated expressions.

Subclass should override AbstractCalc.getCalcs().

Parameters:
exp - Source expression

GenericIterCalc

protected GenericIterCalc(Exp exp,
                          Calc[] calcs)
Creates an GenericIterCalc.

Parameters:
exp - Source expression
calcs - Child compiled expressions
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
Specified by:
getType in interface TupleIterCalc
Overrides:
getType in class AbstractCalc

evaluateList

public java.util.List 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.

evaluateMemberList

public final java.util.List<Member> evaluateMemberList(Evaluator evaluator)
Description copied from interface: MemberListCalc
Evaluates an expression to yield a list of members.

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

Specified by:
evaluateMemberList in interface MemberListCalc
Parameters:
evaluator - Evaluation context
Returns:
A list of members, never null.

evaluateTupleList

public final java.util.List<Member[]> evaluateTupleList(Evaluator evaluator)
Description copied from interface: TupleListCalc
Evaluates an expression to yield a list of tuples.

Each tuple is represented by an array of members.

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

Specified by:
evaluateTupleList in interface TupleListCalc
Parameters:
evaluator - Evaluation context
Returns:
A list of tuples, never null.

evaluateIterable

public java.lang.Iterable 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.

evaluateMemberIterable

public java.lang.Iterable<Member> evaluateMemberIterable(Evaluator evaluator)
Description copied from interface: MemberIterCalc
Evaluates an expression to yield a member iterator.

Specified by:
evaluateMemberIterable in interface MemberIterCalc
Parameters:
evaluator - Evaluation context
Returns:
A member iterator, never null.

evaluateTupleIterable

public java.lang.Iterable<Member[]> evaluateTupleIterable(Evaluator evaluator)
Description copied from interface: TupleIterCalc
Evaluates an expression to yield an iterator over tuples (arrays of members).

Specified by:
evaluateTupleIterable in interface TupleIterCalc
Parameters:
evaluator - Evaluation context
Returns:
A tuple iterator, never null.

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