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 class
ExpCompiler.Factory
TheExpCompiler.Factory
is used to accessExpCompiler
implementations.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Calc
compile(Exp exp)
Compiles an expression.Calc
compileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultStyles)
Compiles an expression to a given result type.BooleanCalc
compileBoolean(Exp exp)
Compiles an expression which yields aboolean
result.DateTimeCalc
compileDateTime(Exp exp)
Compiles an expression which yields aDate
result.DimensionCalc
compileDimension(Exp exp)
Compiles an expression which yields aDimension
result.DoubleCalc
compileDouble(Exp exp)
Compiles an expression which yields adouble
result.HierarchyCalc
compileHierarchy(Exp exp)
Compiles an expression which yields aHierarchy
result.IntegerCalc
compileInteger(Exp exp)
Compiles an expression which yields anint
result.IterCalc
compileIter(Exp exp)
Compiles an expression which yields an immutableIterable
result.LevelCalc
compileLevel(Exp exp)
Compiles an expression which yields aLevel
result.ListCalc
compileList(Exp exp)
Compiles an expression which yields an immutableTupleList
result.ListCalc
compileList(Exp exp, boolean mutable)
Compiles an expression which yieldsTupleList
result.MemberCalc
compileMember(Exp exp)
Compiles an expression which yields aMember
result.Calc
compileScalar(Exp exp, boolean specific)
Compiles an expression to yield a scalar result.StringCalc
compileString(Exp exp)
Compiles an expression which yields aString
result.TupleCalc
compileTuple(Exp exp)
Compiles an expression which yields a tuple result.List<ResultStyle>
getAcceptableResultStyles()
Returns a list of theResultStyle
s acceptable to the caller.Evaluator
getEvaluator()
Returns the evaluator to be used for evaluating expressions during the compilation process.Validator
getValidator()
Returns the validator which was used to validate this expression.ParameterSlot
registerParameter(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
resultType
is not null, casts the expression to that type. Throws an exception if that conversion is not allowed by the type system.The
preferredResultStyles
parameter 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 aMember
result.
-
compileDimension
DimensionCalc compileDimension(Exp exp)
Compiles an expression which yields aDimension
result.
-
compileHierarchy
HierarchyCalc compileHierarchy(Exp exp)
Compiles an expression which yields aHierarchy
result.
-
compileInteger
IntegerCalc compileInteger(Exp exp)
Compiles an expression which yields anint
result. The expression is implicitly converted into a scalar.
-
compileString
StringCalc compileString(Exp exp)
Compiles an expression which yields aString
result. The expression is implicitly converted into a scalar.
-
compileDateTime
DateTimeCalc compileDateTime(Exp exp)
Compiles an expression which yields aDate
result. The expression is implicitly converted into a scalar.
-
compileList
ListCalc compileList(Exp exp)
Compiles an expression which yields an immutableTupleList
result.Always equivalent to
.compileList(mondrian.olap.Exp)
(exp, false)
-
compileList
ListCalc compileList(Exp exp, boolean mutable)
Compiles an expression which yieldsTupleList
result.Such an expression is generally a list of
Member
objects or a list of tuples (each represented by aMember
array).- Parameters:
exp
- Expressionmutable
- Whether resulting list is mutable
-
compileIter
IterCalc compileIter(Exp exp)
Compiles an expression which yields an immutableIterable
result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields an Iterable
-
compileBoolean
BooleanCalc compileBoolean(Exp exp)
Compiles an expression which yields aboolean
result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields a boolean
-
compileDouble
DoubleCalc compileDouble(Exp exp)
Compiles an expression which yields adouble
result.- 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, ifspecific
is true andexp
is 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 theResultStyle
s acceptable to the caller.
-
-