Package mondrian.calc.impl
Class DelegatingExpCompiler
- java.lang.Object
 - 
- mondrian.calc.impl.DelegatingExpCompiler
 
 
- 
- All Implemented Interfaces:
 ExpCompiler
public class DelegatingExpCompiler extends Object implements ExpCompiler
Abstract implementation ofExpCompiler- Since:
 - Jan 2, 2006
 - Author:
 - jhyde
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface mondrian.calc.ExpCompiler
ExpCompiler.Factory 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedDelegatingExpCompiler(ExpCompiler parent) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CalcafterCompile(Exp exp, Calc calc, boolean mutable)Hook for post-processing.Calccompile(Exp exp)Compiles an expression.CalccompileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultTypes)Compiles an expression to a given result type.BooleanCalccompileBoolean(Exp exp)Compiles an expression which yields abooleanresult.DateTimeCalccompileDateTime(Exp exp)Compiles an expression which yields aDateresult.DimensionCalccompileDimension(Exp exp)Compiles an expression which yields aDimensionresult.DoubleCalccompileDouble(Exp exp)Compiles an expression which yields adoubleresult.HierarchyCalccompileHierarchy(Exp exp)Compiles an expression which yields aHierarchyresult.IntegerCalccompileInteger(Exp exp)Compiles an expression which yields anintresult.IterCalccompileIter(Exp exp)Compiles an expression which yields an immutableIterableresult.LevelCalccompileLevel(Exp exp)Compiles an expression which yields aLevelresult.ListCalccompileList(Exp exp)Compiles an expression which yields an immutableTupleListresult.ListCalccompileList(Exp exp, boolean mutable)Compiles an expression which yieldsTupleListresult.MemberCalccompileMember(Exp exp)Compiles an expression which yields aMemberresult.CalccompileScalar(Exp exp, boolean scalar)Compiles an expression to yield a scalar result.StringCalccompileString(Exp exp)Compiles an expression which yields aStringresult.TupleCalccompileTuple(Exp exp)Compiles an expression which yields a tuple result.List<ResultStyle>getAcceptableResultStyles()Returns a list of theResultStyles acceptable to the caller.EvaluatorgetEvaluator()Returns the evaluator to be used for evaluating expressions during the compilation process.ValidatorgetValidator()Returns the validator which was used to validate this expression.ParameterSlotregisterParameter(Parameter parameter)Implements a parameter, returning a unique slot which will hold the parameter's value. 
 - 
 
- 
- 
Constructor Detail
- 
DelegatingExpCompiler
protected DelegatingExpCompiler(ExpCompiler parent)
 
 - 
 
- 
Method Detail
- 
afterCompile
protected Calc afterCompile(Exp exp, Calc calc, boolean mutable)
Hook for post-processing.- Parameters:
 exp- Expression to compilecalc- Calculator created by compilermutable- Whether the result is mutuable- Returns:
 - Calculator after post-processing
 
 
- 
getEvaluator
public Evaluator getEvaluator()
Description copied from interface:ExpCompilerReturns the evaluator to be used for evaluating expressions during the compilation process.- Specified by:
 getEvaluatorin interfaceExpCompiler
 
- 
getValidator
public Validator getValidator()
Description copied from interface:ExpCompilerReturns the validator which was used to validate this expression.- Specified by:
 getValidatorin interfaceExpCompiler- Returns:
 - validator
 
 
- 
compile
public Calc compile(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression.- Specified by:
 compilein interfaceExpCompiler- Parameters:
 exp- Expression- Returns:
 - Compiled expression
 
 
- 
compileAs
public Calc compileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultTypes)
Description copied from interface:ExpCompilerCompiles an expression to a given result type.If
resultTypeis not null, casts the expression to that type. Throws an exception if that conversion is not allowed by the type system.The
preferredResultStylesparameter specifies a list of desired result styles. It must not be null, but may be empty.- Specified by:
 compileAsin interfaceExpCompiler- Parameters:
 exp- ExpressionresultType- Desired result type, or null to use expression's current typepreferredResultTypes- List of result types, in descending order of preference. Never null.- Returns:
 - Compiled expression, or null if none can satisfy
 
 
- 
compileMember
public MemberCalc compileMember(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aMemberresult.- Specified by:
 compileMemberin interfaceExpCompiler
 
- 
compileLevel
public LevelCalc compileLevel(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aLevelresult.- Specified by:
 compileLevelin interfaceExpCompiler
 
- 
compileDimension
public DimensionCalc compileDimension(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aDimensionresult.- Specified by:
 compileDimensionin interfaceExpCompiler
 
- 
compileHierarchy
public HierarchyCalc compileHierarchy(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aHierarchyresult.- Specified by:
 compileHierarchyin interfaceExpCompiler
 
- 
compileInteger
public IntegerCalc compileInteger(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields anintresult. The expression is implicitly converted into a scalar.- Specified by:
 compileIntegerin interfaceExpCompiler
 
- 
compileString
public StringCalc compileString(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aStringresult. The expression is implicitly converted into a scalar.- Specified by:
 compileStringin interfaceExpCompiler
 
- 
compileDateTime
public DateTimeCalc compileDateTime(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields aDateresult. The expression is implicitly converted into a scalar.- Specified by:
 compileDateTimein interfaceExpCompiler
 
- 
compileList
public final ListCalc compileList(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields an immutableTupleListresult.Always equivalent to
.ExpCompiler.compileList(mondrian.olap.Exp)(exp, false)- Specified by:
 compileListin interfaceExpCompiler
 
- 
compileList
public ListCalc compileList(Exp exp, boolean mutable)
Description copied from interface:ExpCompilerCompiles an expression which yieldsTupleListresult.Such an expression is generally a list of
Memberobjects or a list of tuples (each represented by aMemberarray).- Specified by:
 compileListin interfaceExpCompiler- Parameters:
 exp- Expressionmutable- Whether resulting list is mutable
 
- 
compileIter
public IterCalc compileIter(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields an immutableIterableresult.- Specified by:
 compileIterin interfaceExpCompiler- Parameters:
 exp- Expression- Returns:
 - Calculator which yields an Iterable
 
 
- 
compileBoolean
public BooleanCalc compileBoolean(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields abooleanresult.- Specified by:
 compileBooleanin interfaceExpCompiler- Parameters:
 exp- Expression- Returns:
 - Calculator which yields a boolean
 
 
- 
compileDouble
public DoubleCalc compileDouble(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields adoubleresult.- Specified by:
 compileDoublein interfaceExpCompiler- Parameters:
 exp- Expression- Returns:
 - Calculator which yields a double
 
 
- 
compileTuple
public TupleCalc compileTuple(Exp exp)
Description copied from interface:ExpCompilerCompiles an expression which yields a tuple result.- Specified by:
 compileTuplein interfaceExpCompiler- Parameters:
 exp- Expression- Returns:
 - Calculator which yields a tuple
 
 
- 
compileScalar
public Calc compileScalar(Exp exp, boolean scalar)
Description copied from interface:ExpCompilerCompiles an expression to yield a scalar result.If the expression yields a member or tuple, the calculator will automatically apply that member or tuple to the current dimensional context and return the value of the current measure.
- Specified by:
 compileScalarin interfaceExpCompiler- Parameters:
 exp- Expressionscalar- Whether to try to use the specific compile method for scalar types. For example, ifspecificis true andexpis a string expression, callsExpCompiler.compileString(mondrian.olap.Exp)- Returns:
 - Calculation which returns the scalar value of the expression
 
 
- 
registerParameter
public ParameterSlot registerParameter(Parameter parameter)
Description copied from interface:ExpCompilerImplements a parameter, returning a unique slot which will hold the parameter's value.- Specified by:
 registerParameterin interfaceExpCompiler- Parameters:
 parameter- Parameter- Returns:
 - Slot
 
 
- 
getAcceptableResultStyles
public List<ResultStyle> getAcceptableResultStyles()
Description copied from interface:ExpCompilerReturns a list of theResultStyles acceptable to the caller.- Specified by:
 getAcceptableResultStylesin interfaceExpCompiler
 
 - 
 
 -