KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > FunDef


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/FunDef.java#16 $
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) 1999-2002 Kana Software, Inc.
7 // Copyright (C) 2001-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, 21 April, 1999
12 */

13
14 package mondrian.olap;
15
16 import mondrian.calc.Calc;
17 import mondrian.calc.ExpCompiler;
18 import mondrian.mdx.ResolvedFunCall;
19
20 import java.io.PrintWriter JavaDoc;
21
22 /**
23  * <code>FunDef</code> is the definition of an MDX function. See also {@link
24  * FunTable}.
25  */

26 public interface FunDef {
27     /**
28      * Returns the syntactic type of the function.
29      */

30     Syntax getSyntax();
31
32     /**
33      * Returns the name of this function.
34      */

35     String JavaDoc getName();
36
37     /**
38      * Returns the description of this function.
39      */

40     String JavaDoc getDescription();
41
42     /**
43      * Returns the {@link Category} code of the value returned by this
44      * function.
45      */

46     int getReturnCategory();
47
48     /**
49      * Returns the types of the arguments of this function. Values are the same
50      * as those returned by {@link Exp#getCategory()}. The 0<sup>th</sup>
51      * argument of methods and properties are the object they are applied
52      * to. Infix operators have two arguments, and prefix operators have one
53      * argument.
54      */

55     int[] getParameterCategories();
56
57     /**
58      * Creates an expression which represents a call to this function with
59      * a given set of arguments. The result is usually a {@link ResolvedFunCall} but
60      * not always.
61      */

62     Exp createCall(Validator validator, Exp[] args);
63
64     /**
65      * Returns an English description of the signature of the function, for
66      * example "&lt;Numeric Expression&gt; / &lt;Numeric Expression&gt;".
67      */

68     String JavaDoc getSignature();
69
70     /**
71      * Converts a function call into MDX source code.
72      */

73     void unparse(Exp[] args, PrintWriter JavaDoc pw);
74
75     /**
76      * Converts a call to this function into executable objects.
77      *
78      * <p>The result must implement the appropriate interface for the result
79      * type. For example, a function which returns an integer must return
80      * an object which implements {@link mondrian.calc.IntegerCalc}.
81      */

82     Calc compileCall(ResolvedFunCall call, ExpCompiler compiler);
83
84 }
85
86 // End FunDef.java
87
Popular Tags