org.exist.xquery
Class FunctionCall

java.lang.Object
  extended byorg.exist.xquery.AbstractExpression
      extended byorg.exist.xquery.PathExpr
          extended byorg.exist.xquery.Function
              extended byorg.exist.xquery.FunctionCall
All Implemented Interfaces:
CompiledExpression, CompiledXQuery, Expression

public class FunctionCall
extends Function

Represents a call to a user-defined function UserDefinedFunction. FunctionCall wraps around a user-defined function. It makes sure that all function parameters are checked against the signature of the function.

Author:
wolf

Field Summary
 
Fields inherited from class org.exist.xquery.Function
BUILTIN_FUNCTION_NS
 
Fields inherited from interface org.exist.xquery.Expression
DOT_TEST, EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NO_CONTEXT_ID, SINGLE_STEP_EXECUTION
 
Constructor Summary
FunctionCall(XQueryContext context, QName name, java.util.List arguments)
           
FunctionCall(XQueryContext context, UserDefinedFunction functionDef)
           
 
Method Summary
 void analyze(AnalyzeContextInfo contextInfo)
          Statically analyze the expression and its subexpressions.
 Sequence eval(Sequence contextSequence, Item contextItem)
          Evaluates all arguments, then forwards them to the user-defined function.
 Sequence evalFunction(Sequence contextSequence, Item contextItem, Sequence[] seq)
           
 int getArgumentCount()
          Get the number of arguments passed to this function.
 QName getQName()
           
 void resetState()
          Called to inform an expression that it should reset to its initial state.
 void resolveForwardReference(UserDefinedFunction functionDef)
          Called by XQueryContext to resolve a call to a function that has not yet been declared.
 
Methods inherited from class org.exist.xquery.Function
createFunction, dump, getArgument, getArguments, getASTNode, getCardinality, getDependencies, getName, getParent, getSignature, isCalledAs, returnsType, setArguments, setASTNode, setParent, setPrimaryAxis, toString
 
Methods inherited from class org.exist.xquery.PathExpr
accept, add, add, addPath, addPredicate, dump, getContext, getDocumentSet, getExpression, getLastExpression, getLength, getLiteralValue, getSource, isValid, replaceLastExpression, reset, setContext, setSource
 
Methods inherited from class org.exist.xquery.AbstractExpression
eval, getContextDocSet, getContextId, getExpressionId, setContextDocSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.exist.xquery.CompiledXQuery
eval
 

Constructor Detail

FunctionCall

public FunctionCall(XQueryContext context,
                    QName name,
                    java.util.List arguments)

FunctionCall

public FunctionCall(XQueryContext context,
                    UserDefinedFunction functionDef)
Method Detail

analyze

public void analyze(AnalyzeContextInfo contextInfo)
             throws XPathException
Description copied from interface: Expression
Statically analyze the expression and its subexpressions. During the static analysis phase, the query engine can detect unknown variables and some type errors.

Specified by:
analyze in interface Expression
Overrides:
analyze in class Function
Throws:
XPathException

resolveForwardReference

public void resolveForwardReference(UserDefinedFunction functionDef)
                             throws XPathException
Called by XQueryContext to resolve a call to a function that has not yet been declared. XQueryContext remembers all calls to undeclared functions and tries to resolve them after parsing has completed.

Parameters:
functionDef -
Throws:
XPathException

getArgumentCount

public int getArgumentCount()
Description copied from class: Function
Get the number of arguments passed to this function.

Overrides:
getArgumentCount in class Function
Returns:
number of arguments

getQName

public QName getQName()

eval

public Sequence eval(Sequence contextSequence,
                     Item contextItem)
              throws XPathException
Evaluates all arguments, then forwards them to the user-defined function. The return value of the user-defined function will be checked against the provided function signature.

Specified by:
eval in interface Expression
Specified by:
eval in class Function
Throws:
XPathException
See Also:
Expression.eval(Sequence, Item)

evalFunction

public Sequence evalFunction(Sequence contextSequence,
                             Item contextItem,
                             Sequence[] seq)
                      throws XPathException
Parameters:
contextSequence -
contextItem -
seq -
Throws:
XPathException

resetState

public void resetState()
Description copied from interface: Expression
Called to inform an expression that it should reset to its initial state. All cached data in the expression object should be dropped. For example, the document() function calls this method whenever the input document set has changed.

Specified by:
resetState in interface Expression
Overrides:
resetState in class PathExpr


Copyright (C) Wolfgang Meier. All rights reserved.