org.basex.query.func
Class Functions

java.lang.Object
  extended by org.basex.util.hash.ASet
      extended by org.basex.util.hash.TokenSet
          extended by org.basex.query.func.Functions
All Implemented Interfaces:
java.lang.Iterable<byte[]>

public final class Functions
extends TokenSet

This class provides access to statically available functions.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.util.hash.TokenSet
keys
 
Fields inherited from class org.basex.util.hash.ASet
bucket, next, size
 
Method Summary
static Functions get()
          Returns the singleton instance.
static TypedFunc get(QNm name, Expr[] args, boolean dyn, QueryContext ctx, InputInfo ii)
          Returns an instance of a with the specified name and number of arguments, or null.
 StandardFunc get(QNm name, Expr[] args, InputInfo ii)
          Returns the specified function.
static Expr getLiteral(QNm name, int arity, QueryContext ctx, InputInfo ii)
          Gets a function literal for a known function.
static FuncItem getUser(StaticFunc sf, QueryContext ctx, InputInfo info)
          Returns a function item for a user-defined function.
protected  void rehash(int s)
          Rehashes all entries.
 
Methods inherited from class org.basex.util.hash.TokenSet
add, add, clear, contains, delete, hash, id, iterator, key, put, read, toString, write
 
Methods inherited from class org.basex.util.hash.ASet
checkSize, isEmpty, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static Functions get()
Returns the singleton instance.

Returns:
instance

get

public StandardFunc get(QNm name,
                        Expr[] args,
                        InputInfo ii)
                 throws QueryException
Returns the specified function.

Parameters:
name - function qname
args - optional arguments
ii - input info
Returns:
function instance
Throws:
QueryException - query exception

getLiteral

public static Expr getLiteral(QNm name,
                              int arity,
                              QueryContext ctx,
                              InputInfo ii)
                       throws QueryException
Gets a function literal for a known function.

Parameters:
name - function name
arity - number of arguments
ctx - query context
ii - input info
Returns:
function literal if found, null otherwise
Throws:
QueryException - query exception

getUser

public static FuncItem getUser(StaticFunc sf,
                               QueryContext ctx,
                               InputInfo info)
                        throws QueryException
Returns a function item for a user-defined function.

Parameters:
sf - static function
ctx - query context
info - input info
Returns:
resulting value
Throws:
QueryException - query exception

get

public static TypedFunc get(QNm name,
                            Expr[] args,
                            boolean dyn,
                            QueryContext ctx,
                            InputInfo ii)
                     throws QueryException
Returns an instance of a with the specified name and number of arguments, or null.

Parameters:
name - name of the function
args - optional arguments
dyn - compile-/run-time flag
ctx - query context
ii - input info
Returns:
function instance
Throws:
QueryException - query exception

rehash

protected void rehash(int s)
Description copied from class: ASet
Rehashes all entries.

Overrides:
rehash in class TokenSet
Parameters:
s - new hash size