Package mondrian.calc.impl
Class GenericCalc
java.lang.Object
mondrian.calc.impl.AbstractCalc
mondrian.calc.impl.GenericCalc
- All Implemented Interfaces:
BooleanCalc,Calc,DateTimeCalc,DimensionCalc,DoubleCalc,HierarchyCalc,IntegerCalc,LevelCalc,MemberCalc,StringCalc,TupleCalc,VoidCalc
- Direct Known Subclasses:
AbstractVoidCalc,AggregateFunDef.AggregateCalc,CacheCalc,ConstantCalc,MemberArrayValueCalc,MemberValueCalc,TupleValueCalc,ValueCalc
public abstract class GenericCalc
extends AbstractCalc
implements TupleCalc, StringCalc, IntegerCalc, DoubleCalc, BooleanCalc, DateTimeCalc, VoidCalc, MemberCalc, LevelCalc, HierarchyCalc, DimensionCalc
Adapter which computes a scalar or tuple expression and converts it to any
required type.
- Since:
- Sep 26, 2005
- Author:
- jhyde
- See Also:
-
Field Summary
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericCalc(Exp exp) Creates a GenericCalc without specifying child calculated expressions.protectedGenericCalc(Exp exp, Calc[] calcs) Creates an GenericCalc. -
Method Summary
Modifier and TypeMethodDescriptionbooleanevaluateBoolean(Evaluator evaluator) Evaluates this expression to yield abooleanvalue.evaluateDateTime(Evaluator evaluator) Evaluates this expression to yield aDatevalue.evaluateDimension(Evaluator evaluator) Evaluates this expression to yield a dimension.doubleevaluateDouble(Evaluator evaluator) Evaluates this expression to yield adoublevalue.evaluateHierarchy(Evaluator evaluator) Evaluates this expression to yield a hierarchy.intevaluateInteger(Evaluator evaluator) Evaluates this expression to yield anintvalue.evaluateLevel(Evaluator evaluator) Evaluates this expression to yield a level.evaluateMember(Evaluator evaluator) Evaluates this expression to yield a member.evaluateString(Evaluator evaluator) Evaluates this expression to yield aStringvalue.Member[]evaluateTuple(Evaluator evaluator) Evaluates this expression to yield a tuple.voidevaluateVoid(Evaluator evaluator) static doublenumberToDouble(Number number) Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, collectArguments, dependsOn, getArguments, getCalcs, getName, getResultStyle, getType, isWrapperFor, simplifyEvaluator, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mondrian.calc.Calc
accept, dependsOn, evaluate, getResultStyle, getType, isWrapperFor, unwrap
-
Constructor Details
-
GenericCalc
Creates a GenericCalc without specifying child calculated expressions.Subclass should override
AbstractCalc.getCalcs().- Parameters:
exp- Source expression
-
GenericCalc
Creates an GenericCalc.- Parameters:
exp- Source expressioncalcs- Child compiled expressions
-
-
Method Details
-
evaluateTuple
Description copied from interface:TupleCalcEvaluates 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:
evaluateTuplein interfaceTupleCalc- Parameters:
evaluator- Evaluation context- Returns:
- an array of members, or null to represent the null tuple
-
evaluateString
Description copied from interface:StringCalcEvaluates this expression to yield aStringvalue.- Specified by:
evaluateStringin interfaceStringCalc- Parameters:
evaluator- Evaluation context- Returns:
- evaluation result
-
evaluateInteger
Description copied from interface:IntegerCalcEvaluates this expression to yield anintvalue. If the result is null, returns the specialFunUtil.IntegerNullvalue.- Specified by:
evaluateIntegerin interfaceIntegerCalc- Parameters:
evaluator- Evaluation context- Returns:
- evaluation result
-
evaluateDouble
Description copied from interface:DoubleCalcEvaluates this expression to yield adoublevalue. If the result is null, returns the specialFunUtil.DoubleNullvalue.- Specified by:
evaluateDoublein interfaceDoubleCalc- Parameters:
evaluator- Evaluation context- Returns:
- evaluation result
-
numberToDouble
-
evaluateBoolean
Description copied from interface:BooleanCalcEvaluates this expression to yield abooleanvalue. If the result is null, returns the specialFunUtil.BooleanNullvalue.- Specified by:
evaluateBooleanin interfaceBooleanCalc- Parameters:
evaluator- Evaluation context- Returns:
- evaluation result
-
evaluateDateTime
Description copied from interface:DateTimeCalcEvaluates this expression to yield aDatevalue.- Specified by:
evaluateDateTimein interfaceDateTimeCalc- Parameters:
evaluator- Evaluation context- Returns:
- evaluation result
-
evaluateVoid
- Specified by:
evaluateVoidin interfaceVoidCalc
-
evaluateMember
Description copied from interface:MemberCalcEvaluates this expression to yield a member.May return the null member (see
Hierarchy.getNullMember()) but never null.- Specified by:
evaluateMemberin interfaceMemberCalc- Parameters:
evaluator- Evaluation context- Returns:
- a member
-
evaluateLevel
Description copied from interface:LevelCalcEvaluates this expression to yield a level.Never returns null.
- Specified by:
evaluateLevelin interfaceLevelCalc- Parameters:
evaluator- Evaluation context- Returns:
- a level
-
evaluateHierarchy
Description copied from interface:HierarchyCalcEvaluates this expression to yield a hierarchy.Never returns null.
- Specified by:
evaluateHierarchyin interfaceHierarchyCalc- Parameters:
evaluator- Evaluation context- Returns:
- a hierarchy
-
evaluateDimension
Description copied from interface:DimensionCalcEvaluates this expression to yield a dimension.Never returns null.
- Specified by:
evaluateDimensionin interfaceDimensionCalc- Parameters:
evaluator- Evaluation context- Returns:
- a dimension
-