001 /* 002 // $Id: //open/mondrian/src/main/mondrian/olap/fun/Resolver.java#13 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2002-2002 Kana Software, Inc. 007 // Copyright (C) 2002-2006 Julian Hyde and others 008 // All Rights Reserved. 009 // You must accept the terms of that agreement to use this software. 010 // 011 // jhyde, 3 March, 2002 012 */ 013 package mondrian.olap.fun; 014 015 import mondrian.olap.*; 016 017 /** 018 * A <code>Resolver</code> converts a function name, invocation type, and set 019 * of arguments into a {@link FunDef}. 020 * 021 * @author jhyde 022 * @since 3 March, 2002 023 * @version $Id: //open/mondrian/src/main/mondrian/olap/fun/Resolver.java#13 $ 024 */ 025 public interface Resolver { 026 /** 027 * Returns the name of the function or operator. 028 */ 029 String getName(); 030 031 /** 032 * Returns the description of the function or operator. 033 */ 034 String getDescription(); 035 036 /** 037 * Returns the syntax with which the function or operator was invoked. 038 */ 039 Syntax getSyntax(); 040 041 /** 042 * Given a particular set of arguments the function is applied to, returns 043 * the correct overloaded form of the function. 044 * 045 * <p>The method must increment <code>conversionCount</code> argument every 046 * time it performs an implicit type-conversion. If there are several 047 * candidate functions with the same signature, the validator will choose 048 * the one which used the fewest implicit conversions. 049 * 050 * @param args Expressions which this function call is applied to. 051 * @param validator Validator 052 * @param conversionCount This argument must be an <code>int</code> array 053 * with a single element; in effect, it is an in/out parameter. It 054 * The method increments the count every time it performs a conversion. 055 * 056 * @return The function definition which matches these arguments, or null 057 * if no function definition that this resolver knows about matches. 058 */ 059 FunDef resolve(Exp[] args, Validator validator, int[] conversionCount); 060 061 /** 062 * Returns whether a particular argument must be a scalar expression. 063 * Returns <code>false</code> if any of the variants of this resolver 064 * allows a set as its <code>k</code>th argument; true otherwise. 065 */ 066 boolean requiresExpression(int k); 067 068 /** 069 * Returns an array of symbolic constants which can appear as arguments 070 * to this function. 071 * 072 * <p>For example, the <code>DrilldownMember</code> may take the symbol 073 * <code>RECURSIVE</code> as an argument. Most functions do not define 074 * any symbolic constants. 075 * 076 * @return An array of the names of the symbolic constants 077 */ 078 String[] getReservedWords(); 079 080 /** 081 * Returns a string describing the syntax of this function, for example 082 * <pre><code>StrToSet(<String Expression>)</code></pre> 083 */ 084 String getSignature(); 085 086 /** 087 * Returns a representative example of the function which this Resolver 088 * can produce, for purposes of describing the function set. May return 089 * null if there is no representative function, or if the Resolver has 090 * a way to describe itself in more detail. 091 */ 092 FunDef getFunDef(); 093 } 094 095 // End Resolver.java