Package mondrian.calc
Interface ExpCompiler
-
- All Known Implementing Classes:
AbstractExpCompiler,BetterExpCompiler,DelegatingExpCompiler
public interface ExpCompiler- Since:
- Sep 28, 2005
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classExpCompiler.FactoryTheExpCompiler.Factoryis used to accessExpCompilerimplementations.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Calccompile(Exp exp)Compiles an expression.CalccompileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultStyles)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 specific)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.
-
-
-
Method Detail
-
getEvaluator
Evaluator getEvaluator()
Returns the evaluator to be used for evaluating expressions during the compilation process.
-
getValidator
Validator getValidator()
Returns the validator which was used to validate this expression.- Returns:
- validator
-
compile
Calc compile(Exp exp)
Compiles an expression.- Parameters:
exp- Expression- Returns:
- Compiled expression
-
compileAs
Calc compileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultStyles)
Compiles 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.- Parameters:
exp- ExpressionresultType- Desired result type, or null to use expression's current typepreferredResultStyles- List of result types, in descending order of preference. Never null.- Returns:
- Compiled expression, or null if none can satisfy
-
compileMember
MemberCalc compileMember(Exp exp)
Compiles an expression which yields aMemberresult.
-
compileDimension
DimensionCalc compileDimension(Exp exp)
Compiles an expression which yields aDimensionresult.
-
compileHierarchy
HierarchyCalc compileHierarchy(Exp exp)
Compiles an expression which yields aHierarchyresult.
-
compileInteger
IntegerCalc compileInteger(Exp exp)
Compiles an expression which yields anintresult. The expression is implicitly converted into a scalar.
-
compileString
StringCalc compileString(Exp exp)
Compiles an expression which yields aStringresult. The expression is implicitly converted into a scalar.
-
compileDateTime
DateTimeCalc compileDateTime(Exp exp)
Compiles an expression which yields aDateresult. The expression is implicitly converted into a scalar.
-
compileList
ListCalc compileList(Exp exp)
Compiles an expression which yields an immutableTupleListresult.Always equivalent to
.compileList(mondrian.olap.Exp)(exp, false)
-
compileList
ListCalc compileList(Exp exp, boolean mutable)
Compiles an expression which yieldsTupleListresult.Such an expression is generally a list of
Memberobjects or a list of tuples (each represented by aMemberarray).- Parameters:
exp- Expressionmutable- Whether resulting list is mutable
-
compileIter
IterCalc compileIter(Exp exp)
Compiles an expression which yields an immutableIterableresult.- Parameters:
exp- Expression- Returns:
- Calculator which yields an Iterable
-
compileBoolean
BooleanCalc compileBoolean(Exp exp)
Compiles an expression which yields abooleanresult.- Parameters:
exp- Expression- Returns:
- Calculator which yields a boolean
-
compileDouble
DoubleCalc compileDouble(Exp exp)
Compiles an expression which yields adoubleresult.- Parameters:
exp- Expression- Returns:
- Calculator which yields a double
-
compileTuple
TupleCalc compileTuple(Exp exp)
Compiles an expression which yields a tuple result.- Parameters:
exp- Expression- Returns:
- Calculator which yields a tuple
-
compileScalar
Calc compileScalar(Exp exp, boolean specific)
Compiles 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.
- Parameters:
exp- Expressionspecific- Whether to try to use the specific compile method for scalar types. For example, ifspecificis true andexpis a string expression, callscompileString(mondrian.olap.Exp)- Returns:
- Calculation which returns the scalar value of the expression
-
registerParameter
ParameterSlot registerParameter(Parameter parameter)
Implements a parameter, returning a unique slot which will hold the parameter's value.- Parameters:
parameter- Parameter- Returns:
- Slot
-
getAcceptableResultStyles
List<ResultStyle> getAcceptableResultStyles()
Returns a list of theResultStyles acceptable to the caller.
-
-