Package mondrian.calc
Interface ExpCompiler
- All Known Implementing Classes:
AbstractExpCompiler
,BetterExpCompiler
,DelegatingExpCompiler
public interface ExpCompiler
- Since:
- Sep 28, 2005
- Author:
- jhyde
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
TheExpCompiler.Factory
is used to accessExpCompiler
implementations. -
Method Summary
Modifier and TypeMethodDescriptionCompiles an expression.compileAs
(Exp exp, Type resultType, List<ResultStyle> preferredResultStyles) Compiles an expression to a given result type.compileBoolean
(Exp exp) Compiles an expression which yields aboolean
result.compileDateTime
(Exp exp) Compiles an expression which yields aDate
result.compileDimension
(Exp exp) Compiles an expression which yields aDimension
result.compileDouble
(Exp exp) Compiles an expression which yields adouble
result.compileHierarchy
(Exp exp) Compiles an expression which yields aHierarchy
result.compileInteger
(Exp exp) Compiles an expression which yields anint
result.compileIter
(Exp exp) Compiles an expression which yields an immutableIterable
result.compileLevel
(Exp exp) Compiles an expression which yields aLevel
result.compileList
(Exp exp) Compiles an expression which yields an immutableTupleList
result.compileList
(Exp exp, boolean mutable) Compiles an expression which yieldsTupleList
result.compileMember
(Exp exp) Compiles an expression which yields aMember
result.compileScalar
(Exp exp, boolean specific) Compiles an expression to yield a scalar result.compileString
(Exp exp) Compiles an expression which yields aString
result.compileTuple
(Exp exp) Compiles an expression which yields a tuple result.Returns a list of theResultStyle
s acceptable to the caller.Returns the evaluator to be used for evaluating expressions during the compilation process.Returns the validator which was used to validate this expression.registerParameter
(Parameter parameter) Implements a parameter, returning a unique slot which will hold the parameter's value.
-
Method Details
-
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
Compiles an expression.- Parameters:
exp
- Expression- Returns:
- Compiled expression
-
compileAs
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
Compiles an expression which yields aMember
result. -
compileLevel
Compiles an expression which yields aLevel
result. -
compileDimension
Compiles an expression which yields aDimension
result. -
compileHierarchy
Compiles an expression which yields aHierarchy
result. -
compileInteger
Compiles an expression which yields anint
result. The expression is implicitly converted into a scalar. -
compileString
Compiles an expression which yields aString
result. The expression is implicitly converted into a scalar. -
compileDateTime
Compiles an expression which yields aDate
result. The expression is implicitly converted into a scalar. -
compileList
Compiles an expression which yields an immutableTupleList
result.Always equivalent to
.compileList(mondrian.olap.Exp)
(exp, false) -
compileList
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
Compiles an expression which yields an immutableIterable
result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields an Iterable
-
compileBoolean
Compiles an expression which yields aboolean
result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields a boolean
-
compileDouble
Compiles an expression which yields adouble
result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields a double
-
compileTuple
Compiles an expression which yields a tuple result.- Parameters:
exp
- Expression- Returns:
- Calculator which yields a tuple
-
compileScalar
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
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.
-