| java.lang.Object net.sf.saxon.instruct.Procedure net.sf.saxon.instruct.UserFunction
UserFunction | final public class UserFunction extends Procedure implements InstructionInfoProvider(Code) | | This object represents the compiled form of a user-written function
(the source can be either an XSLT stylesheet function or an XQuery function).
It is assumed that type-checking, of both the arguments and the results,
has been handled at compile time. That is, the expression supplied as the body
of the function must be wrapped in code to check or convert the result to the
required type, and calls on the function must be wrapped at compile time to check or
convert the supplied arguments.
|
UserFunction | public UserFunction()(Code) | | |
call | public ValueRepresentation call(ValueRepresentation[] actualArgs, XPathContextMajor context, boolean evaluateTailCalls) throws XPathException(Code) | | Call this function.
Parameters: actualArgs - the arguments supplied to the function. These must have the correcttypes required by the function signature (it is the caller's responsibility to check this).It is acceptable to supply a net.sf.saxon.value.Closure to represent a value whoseevaluation will be delayed until it is needed. The array must be the correct size to matchthe number of arguments: again, it is the caller's responsibility to check this. Parameters: context - This provides the run-time context for evaluating the function. It is the caller'sresponsibility to allocate a "clean" context for the function to use; the context that is providedwill be overwritten by the function. Parameters: evaluateTailCalls - if true, then any function calls contained in the body of the functionare evaluated in the normal way, whether or not they are marked as tail calls. If the argumentis false, then tail calls are not evaluated, and instead a FunctionCallPackage is returned containingthe information needed to evaluate the function. The caller must then be prepared to deal with thisreturned value by evaluating the packaged function call (which may return further packaged functioncalls, and so on). a Value representing the result of the function. |
call | public ValueRepresentation call(ValueRepresentation[] actualArgs, Controller controller) throws XPathException(Code) | | Call this function. This method allows an XQuery function to be called directly from a Java
application. It creates the environment needed to achieve this
Parameters: actualArgs - the arguments supplied to the function. These must have the correcttypes required by the function signature (it is the caller's responsibility to check this).It is acceptable to supply a net.sf.saxon.value.Closure to represent a value whoseevaluation will be delayed until it is needed. The array must be the correct size to matchthe number of arguments: again, it is the caller's responsibility to check this. Parameters: controller - This provides the run-time context for evaluating the function. A Controllermay be obtained by calling net.sf.saxon.query.XQueryExpression.newController. This maybe used for a series of calls on functions defined in the same module as the XQueryExpression. a Value representing the result of the function. |
getArgumentType | public SequenceType getArgumentType(int n)(Code) | | Get the required types of an argument to this function
Parameters: n - identifies the argument in question, starting at 0 a SequenceType object, indicating the required type of the argument |
getFunctionNameCode | public int getFunctionNameCode()(Code) | | Get the namepool name code of the function
a name code representing the function name |
getInstructionInfo | public InstructionInfo getInstructionInfo()(Code) | | Get the InstructionInfo details about the construct. This information isn't used for tracing,
but it is available when inspecting the context stack.
|
getNumberOfArguments | public int getNumberOfArguments()(Code) | | Get the arity of this function
the number of arguments |
getResultType | public SequenceType getResultType()(Code) | | Get the type of value returned by this function
the declared result type, or the inferred result typeif this is more precise |
setFunctionNameCode | public void setFunctionNameCode(int nameCode)(Code) | | Set the namepool name code of the function
Parameters: nameCode - represents the function name |
setMemoFunction | public void setMemoFunction(boolean isMemo)(Code) | | Mark this function as a memo function (or not)
Parameters: isMemo - true if this is a memo function |
setTailRecursive | public void setTailRecursive(boolean tailCalls)(Code) | | |
|
|