KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > Validator


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/Validator.java#7 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2005-2006 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.olap;
11
12 import mondrian.olap.fun.ParameterFunDef;
13 import mondrian.olap.type.Type;
14 import mondrian.mdx.ParameterExpr;
15
16 /**
17  * Provides context necessary to resolve identifiers to objects, function
18  * calls to specific functions.
19  *
20  * <p>An expression calls {@link #validate} on each of its children,
21  * which in turn calls {@link Exp#accept}.
22  *
23  * @author jhyde
24  * @version $Id: //open/mondrian/src/main/mondrian/olap/Validator.java#7 $
25  */

26 public interface Validator {
27     /**
28      * Returns the {@link Query} which is being validated.
29      */

30     Query getQuery();
31
32     /**
33      * Validates an expression, and returns the expression it resolves to.
34      *
35      * @param exp Expression to validate
36      * @param scalar Whether the context requires that the expression is
37      * evaluated to a value, as opposed to a tuple
38      */

39     Exp validate(Exp exp, boolean scalar);
40
41     /**
42      * Validates a usage of a parameter.
43      *
44      * <p>It must resolve to the same object (although sub-objects may change).
45      */

46     void validate(ParameterExpr parameterExpr);
47
48     /**
49      * Validates a child member property.
50      *
51      * <p>It must resolve to the same object (although sub-objects may change).
52      */

53     void validate(MemberProperty memberProperty);
54
55     /**
56      * Validates an axis.
57      *
58      * It must resolve to the same object (although sub-objects may change).
59      */

60     void validate(QueryAxis axis);
61
62     /**
63      * Validates a formula.
64      *
65      * It must resolve to the same object (although sub-objects may change).
66      */

67     void validate(Formula formula);
68
69     /**
70      * Returns whether the current context requires an expression.
71      */

72     boolean requiresExpression();
73
74     /**
75      * Returns whether we can convert an argument to a parameter type.
76      *
77      * @param fromExp argument type
78      * @param to parameter type
79      * @param conversionCount in/out count of number of conversions performed;
80      * is incremented if the conversion is non-trivial (for
81      * example, converting a member to a level).
82      */

83     boolean canConvert(Exp fromExp, int to, int[] conversionCount);
84
85     /**
86      * Returns the table of function and operator definitions.
87      */

88     FunTable getFunTable();
89
90     /**
91      * Creates or retrieves the parameter corresponding to a "Parameter" or
92      * "ParamRef" function call.
93      */

94     Parameter createOrLookupParam(
95         boolean definition,
96         String JavaDoc name,
97         Type type,
98         Exp defaultExp,
99         String JavaDoc description);
100 }
101
102 // End Validator.java
103
Popular Tags