mondrian.calc.impl
Class GenericCalc

java.lang.Object
  extended by mondrian.calc.impl.AbstractCalc
      extended by mondrian.calc.impl.GenericCalc
All Implemented Interfaces:
BooleanCalc, Calc, DateTimeCalc, DimensionCalc, DoubleCalc, HierarchyCalc, IntegerCalc, IterCalc, LevelCalc, ListCalc, MemberCalc, StringCalc, TupleCalc, VoidCalc
Direct Known Subclasses:
AbstractVoidCalc, CacheCalc, ConstantCalc, MemberValueCalc, TupleValueCalc, ValueCalc

public abstract class GenericCalc
extends AbstractCalc
implements ListCalc, IterCalc, TupleCalc, StringCalc, IntegerCalc, DoubleCalc, BooleanCalc, DateTimeCalc, VoidCalc, MemberCalc, LevelCalc, HierarchyCalc, DimensionCalc

Adapter which computes an expression and converts it to any required type.

Since:
Sep 26, 2005
Version:
$Id: //open/mondrian-release/3.0/src/main/mondrian/calc/impl/GenericCalc.java#3 $
Author:
jhyde

Field Summary
 
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type
 
Constructor Summary
protected GenericCalc(Exp exp)
           
 
Method Summary
 boolean evaluateBoolean(Evaluator evaluator)
          Evaluates this expression to yield a boolean value.
 Date evaluateDateTime(Evaluator evaluator)
          Evaluates this expression to yield a Date value.
 Dimension evaluateDimension(Evaluator evaluator)
          Evaluates this expression to yield a dimension.
 double evaluateDouble(Evaluator evaluator)
          Evaluates this expression to yield a double value.
 Hierarchy evaluateHierarchy(Evaluator evaluator)
          Evaluates this expression to yield a hierarchy.
 int evaluateInteger(Evaluator evaluator)
          Evaluates this expression to yield an int value.
 Iterable evaluateIterable(Evaluator evaluator)
          Evaluates an expression to yield an Iterable of members or tuples.
 Level evaluateLevel(Evaluator evaluator)
          Evaluates this expression to yield a level.
 List evaluateList(Evaluator evaluator)
          Evaluates an expression to yield a list of members or tuples.
 Member evaluateMember(Evaluator evaluator)
          Evaluates this expression to yield a member.
 String evaluateString(Evaluator evaluator)
          Evaluates this expression to yield a String value.
 Member[] evaluateTuple(Evaluator evaluator)
          Evaluates this expression to yield a tuple.
 void evaluateVoid(Evaluator evaluator)
           
static double numberToDouble(Number number)
           
 
Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, dependsOn, getArguments, getCalcs, getName, getResultStyle, getType, 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, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 
Methods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType
 

Constructor Detail

GenericCalc

protected GenericCalc(Exp exp)
Method Detail

evaluateList

public 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.

evaluateIterable

public 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.

evaluateTuple

public Member[] evaluateTuple(Evaluator evaluator)
Description copied from interface: TupleCalc
Evaluates this expression to yield a tuple.

A tuple cannot contain any null members. If any of the members is null, this method must return a null.

Specified by:
evaluateTuple in interface TupleCalc
Parameters:
evaluator - Evaluation context
Returns:
an array of members, or null to represent the null tuple

evaluateString

public String evaluateString(Evaluator evaluator)
Description copied from interface: StringCalc
Evaluates this expression to yield a String value.

Specified by:
evaluateString in interface StringCalc
Parameters:
evaluator - Evaluation context
Returns:
evaluation result

evaluateInteger

public int evaluateInteger(Evaluator evaluator)
Description copied from interface: IntegerCalc
Evaluates this expression to yield an int value. If the result is null, returns the special FunUtil.IntegerNull value.

Specified by:
evaluateInteger in interface IntegerCalc
Parameters:
evaluator - Evaluation context
Returns:
evaluation result

evaluateDouble

public double evaluateDouble(Evaluator evaluator)
Description copied from interface: DoubleCalc
Evaluates this expression to yield a double value. If the result is null, returns the special FunUtil.DoubleNull value.

Specified by:
evaluateDouble in interface DoubleCalc
Parameters:
evaluator - Evaluation context
Returns:
evaluation result

numberToDouble

public static double numberToDouble(Number number)

evaluateBoolean

public boolean evaluateBoolean(Evaluator evaluator)
Description copied from interface: BooleanCalc
Evaluates this expression to yield a boolean value. If the result is null, returns the special FunUtil.BooleanNull value.

Specified by:
evaluateBoolean in interface BooleanCalc
Parameters:
evaluator - Evaluation context
Returns:
evaluation result

evaluateDateTime

public Date evaluateDateTime(Evaluator evaluator)
Description copied from interface: DateTimeCalc
Evaluates this expression to yield a Date value.

Specified by:
evaluateDateTime in interface DateTimeCalc
Parameters:
evaluator - Evaluation context
Returns:
evaluation result

evaluateVoid

public void evaluateVoid(Evaluator evaluator)
Specified by:
evaluateVoid in interface VoidCalc

evaluateMember

public Member evaluateMember(Evaluator evaluator)
Description copied from interface: MemberCalc
Evaluates this expression to yield a member.

May return the null member (see Hierarchy.getNullMember()) but never null.

Specified by:
evaluateMember in interface MemberCalc
Parameters:
evaluator - Evaluation context
Returns:
a member

evaluateLevel

public Level evaluateLevel(Evaluator evaluator)
Description copied from interface: LevelCalc
Evaluates this expression to yield a level.

Never returns null.

Specified by:
evaluateLevel in interface LevelCalc
Parameters:
evaluator - Evaluation context
Returns:
a level

evaluateHierarchy

public Hierarchy evaluateHierarchy(Evaluator evaluator)
Description copied from interface: HierarchyCalc
Evaluates this expression to yield a hierarchy.

Never returns null.

Specified by:
evaluateHierarchy in interface HierarchyCalc
Parameters:
evaluator - Evaluation context
Returns:
a hierarchy

evaluateDimension

public Dimension evaluateDimension(Evaluator evaluator)
Description copied from interface: DimensionCalc
Evaluates this expression to yield a dimension.

Never returns null.

Specified by:
evaluateDimension in interface DimensionCalc
Parameters:
evaluator - Evaluation context
Returns:
a dimension

SourceForge.net_Logo