|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmondrian.olap.ValidatorImpl
abstract class ValidatorImpl
Default implementation of Validator.
Uses a stack to help us guess the type of our parent expression before we've completely resolved our children -- necessary, unfortunately, when figuring out whether the "*" operator denotes multiplication or crossjoin.
Keeps track of which nodes have already been resolved, so we don't
try to resolve nodes which have already been resolved. (That would not
be wrong, but can cause resolution to be an O(2^N)
operation.)
The concrete implementing class needs to implement
Validator.getQuery() and defineParameter(Parameter).
| Field Summary | |
|---|---|
protected ArrayStack<QueryPart> |
stack
|
| Constructor Summary | |
|---|---|
protected |
ValidatorImpl(FunTable funTable)
Creates a ValidatorImpl. |
| Method Summary | |
|---|---|
boolean |
alwaysResolveFunDef()
Whether to resolve function name and arguments to a function definition each time a node is validated, not just the first time. |
boolean |
canConvert(int ordinal,
Exp fromExp,
int to,
List<Resolver.Conversion> conversions)
Returns whether we can convert an argument to a parameter type. |
Parameter |
createOrLookupParam(boolean definition,
String name,
Type type,
Exp defaultExp,
String description)
Creates or retrieves the parameter corresponding to a "Parameter" or "ParamRef" function call. |
protected abstract void |
defineParameter(Parameter param)
Defines a parameter. |
FunDef |
getDef(Exp[] args,
String funName,
Syntax syntax)
Resolves a function call to a particular function. |
FunTable |
getFunTable()
Returns the table of function and operator definitions. |
boolean |
requiresExpression()
Returns whether the current context requires an expression. |
(package private) boolean |
requiresExpression(UnresolvedFunCall funCall,
int k)
Returns whether the kth argument to a function call
has to be an expression. |
Exp |
validate(Exp exp,
boolean scalar)
Validates an expression, and returns the expression it resolves to. |
void |
validate(Formula formula)
Validates a formula. |
void |
validate(MemberProperty memberProperty)
Validates a child member property. |
void |
validate(ParameterExpr parameterExpr)
Validates a usage of a parameter. |
void |
validate(QueryAxis axis)
Validates an axis. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface mondrian.olap.Validator |
|---|
getQuery, getSchemaReader |
| Field Detail |
|---|
protected final ArrayStack<QueryPart> stack
| Constructor Detail |
|---|
protected ValidatorImpl(FunTable funTable)
funTable - Function table| Method Detail |
|---|
public Exp validate(Exp exp,
boolean scalar)
Validator
validate in interface Validatorexp - Expression to validatescalar - Whether the context requires that the expression is
evaluated to a value, as opposed to a tuplepublic void validate(ParameterExpr parameterExpr)
ValidatorIt must resolve to the same object (although sub-objects may change).
validate in interface Validatorpublic void validate(MemberProperty memberProperty)
ValidatorIt must resolve to the same object (although sub-objects may change).
validate in interface Validatorpublic void validate(QueryAxis axis)
Validator
validate in interface Validatorpublic void validate(Formula formula)
Validator
validate in interface Validator
public FunDef getDef(Exp[] args,
String funName,
Syntax syntax)
Validator
getDef in interface Validatorpublic boolean alwaysResolveFunDef()
ValidatorDefault implementation returns false.
alwaysResolveFunDef in interface Validator
public boolean canConvert(int ordinal,
Exp fromExp,
int to,
List<Resolver.Conversion> conversions)
Validator
canConvert in interface Validatorordinal - argument ordinalfromExp - argument typeto - parameter typeconversions - List of conversions performed;
method adds an element for each non-trivial conversion (for
example, converting a member to a level).
public boolean requiresExpression()
Validator
requiresExpression in interface Validator
boolean requiresExpression(UnresolvedFunCall funCall,
int k)
kth argument to a function call
has to be an expression.
public FunTable getFunTable()
Validator
getFunTable in interface Validator
public Parameter createOrLookupParam(boolean definition,
String name,
Type type,
Exp defaultExp,
String description)
Validator
createOrLookupParam in interface Validatorprotected abstract void defineParameter(Parameter param)
param - Parameter
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||