mondrian.olap.fun
Class FunTableImpl

java.lang.Object
  extended by mondrian.olap.fun.FunTableImpl
All Implemented Interfaces:
FunTable
Direct Known Subclasses:
BuiltinFunTable, CustomizedFunctionTable, GlobalFunTable, RolapSchema.RolapSchemaFunctionTable

public abstract class FunTableImpl
extends Object
implements FunTable

Abstract implementation of FunTable.

The derived class must implement defineFunctions() to define each function which will be recognized by this table. This method is called from the constructor, after which point, no further functions can be added.

 

Field Summary
protected  List<FunInfo> funInfoList
           
protected  Map<String,List<Resolver>> mapNameToResolvers
          Maps the upper-case name of a function plus its Syntax to an array of Validator objects for that name.
protected  List<Resolver> resolverList
          used during initialization
 
Constructor Summary
protected FunTableImpl()
           
 
Method Summary
protected  void addFunInfo(Resolver resolver)
           
protected  void define(FunDef funDef)
           
protected  void define(Resolver resolver)
           
protected abstract  void defineFunctions()
          This method is called from the constructor, to define the set of functions and reserved words recognized.
protected  void defineProperty(String s)
          Defines a word matching a property function name.
protected  void defineReserved(String s)
          Defines a reserved word.
 FunDef getDef(Exp[] args, Validator validator, String funName, Syntax syntax)
          Resolves a function call to a particular function.
 List<FunInfo> getFunInfoList()
          Returns a list of FunInfo objects.
 List<String> getReservedWords()
          Returns a list of words (String) which may not be used as identifiers.
 List<Resolver> getResolvers()
          Returns a list of Resolver objects.
 void init()
          Initializes the function table.
 boolean isProperty(String s)
          Returns whether a string is a property-style (postfix) operator.
 boolean isReserved(String s)
          Returns whether a string is a reserved word.
protected static String makeResolverKey(String name, Syntax syntax)
           
protected  void organizeFunctions()
          Indexes the collection of functions.
 boolean requiresExpression(UnresolvedFunCall call, int k, Validator validator)
          Returns whether the kth argument to a function call has to be an expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapNameToResolvers

protected final Map<String,List<Resolver>> mapNameToResolvers
Maps the upper-case name of a function plus its Syntax to an array of Validator objects for that name.


resolverList

protected final List<Resolver> resolverList
used during initialization


funInfoList

protected final List<FunInfo> funInfoList
Constructor Detail

FunTableImpl

protected FunTableImpl()
Method Detail

init

public void init()
Initializes the function table.


makeResolverKey

protected static String makeResolverKey(String name,
                                        Syntax syntax)

define

protected void define(FunDef funDef)

define

protected void define(Resolver resolver)

addFunInfo

protected void addFunInfo(Resolver resolver)

getDef

public FunDef getDef(Exp[] args,
                     Validator validator,
                     String funName,
                     Syntax syntax)
Description copied from interface: FunTable
Resolves a function call to a particular function. If the function is overloaded, returns as precise a match to the argument types as possible.

Specified by:
getDef in interface FunTable

requiresExpression

public boolean requiresExpression(UnresolvedFunCall call,
                                  int k,
                                  Validator validator)
Description copied from interface: FunTable
Returns whether the kth argument to a function call has to be an expression.

Specified by:
requiresExpression in interface FunTable

getReservedWords

public List<String> getReservedWords()
Description copied from interface: FunTable
Returns a list of words (String) which may not be used as identifiers.

Specified by:
getReservedWords in interface FunTable

isReserved

public boolean isReserved(String s)
Description copied from interface: FunTable
Returns whether a string is a reserved word.

Specified by:
isReserved in interface FunTable

defineReserved

protected void defineReserved(String s)
Defines a reserved word.

See Also:
isReserved(java.lang.String)

getResolvers

public List<Resolver> getResolvers()
Description copied from interface: FunTable
Returns a list of Resolver objects.

Specified by:
getResolvers in interface FunTable

isProperty

public boolean isProperty(String s)
Description copied from interface: FunTable
Returns whether a string is a property-style (postfix) operator. This is used during parsing to disambiguate functions from unquoted member names.

Specified by:
isProperty in interface FunTable

defineProperty

protected void defineProperty(String s)
Defines a word matching a property function name.

See Also:
isProperty(java.lang.String)

getFunInfoList

public List<FunInfo> getFunInfoList()
Description copied from interface: FunTable
Returns a list of FunInfo objects.

Specified by:
getFunInfoList in interface FunTable

organizeFunctions

protected void organizeFunctions()
Indexes the collection of functions.


defineFunctions

protected abstract void defineFunctions()
This method is called from the constructor, to define the set of functions and reserved words recognized.

Each function is declared by calling define(mondrian.olap.FunDef). Each reserved word is declared by calling defineReserved(String).

Derived class can override this method to add more functions.


SourceForge.net_Logo