KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > fun > Resolver


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/fun/Resolver.java#13 $
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) 2002-2002 Kana Software, Inc.
7 // Copyright (C) 2002-2006 Julian Hyde and others
8 // All Rights Reserved.
9 // You must accept the terms of that agreement to use this software.
10 //
11 // jhyde, 3 March, 2002
12 */

13 package mondrian.olap.fun;
14
15 import mondrian.olap.*;
16
17 /**
18  * A <code>Resolver</code> converts a function name, invocation type, and set
19  * of arguments into a {@link FunDef}.
20  *
21  * @author jhyde
22  * @since 3 March, 2002
23  * @version $Id: //open/mondrian/src/main/mondrian/olap/fun/Resolver.java#13 $
24  */

25 public interface Resolver {
26     /**
27      * Returns the name of the function or operator.
28      */

29     String JavaDoc getName();
30
31     /**
32      * Returns the description of the function or operator.
33      */

34     String JavaDoc getDescription();
35
36     /**
37      * Returns the syntax with which the function or operator was invoked.
38      */

39     Syntax getSyntax();
40
41     /**
42      * Given a particular set of arguments the function is applied to, returns
43      * the correct overloaded form of the function.
44      *
45      * <p>The method must increment <code>conversionCount</code> argument every
46      * time it performs an implicit type-conversion. If there are several
47      * candidate functions with the same signature, the validator will choose
48      * the one which used the fewest implicit conversions.
49      *
50      * @param args Expressions which this function call is applied to.
51      * @param validator Validator
52      * @param conversionCount This argument must be an <code>int</code> array
53      * with a single element; in effect, it is an in/out parameter. It
54      * The method increments the count every time it performs a conversion.
55      *
56      * @return The function definition which matches these arguments, or null
57      * if no function definition that this resolver knows about matches.
58      */

59     FunDef resolve(Exp[] args, Validator validator, int[] conversionCount);
60
61     /**
62      * Returns whether a particular argument must be a scalar expression.
63      * Returns <code>false</code> if any of the variants of this resolver
64      * allows a set as its <code>k</code>th argument; true otherwise.
65      */

66     boolean requiresExpression(int k);
67
68     /**
69      * Returns an array of symbolic constants which can appear as arguments
70      * to this function.
71      *
72      * <p>For example, the <code>DrilldownMember</code> may take the symbol
73      * <code>RECURSIVE</code> as an argument. Most functions do not define
74      * any symbolic constants.
75      *
76      * @return An array of the names of the symbolic constants
77      */

78     String JavaDoc[] getReservedWords();
79
80     /**
81      * Returns a string describing the syntax of this function, for example
82      * <pre><code>StrToSet(<String Expression>)</code></pre>
83      */

84     String JavaDoc getSignature();
85
86     /**
87      * Returns a representative example of the function which this Resolver
88      * can produce, for purposes of describing the function set. May return
89      * null if there is no representative function, or if the Resolver has
90      * a way to describe itself in more detail.
91      */

92     FunDef getFunDef();
93 }
94
95 // End Resolver.java
96
Popular Tags