|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.instruct.Procedure
net.sf.saxon.instruct.UserFunction
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.
Field Summary |
Fields inherited from class net.sf.saxon.instruct.Procedure |
body |
Constructor Summary | |
UserFunction()
|
|
UserFunction(Expression body)
|
Method Summary | |
ValueRepresentation |
call(ValueRepresentation[] actualArgs,
Controller controller)
Call this function. |
ValueRepresentation |
call(ValueRepresentation[] actualArgs,
XPathContextMajor context)
Call this function to return a value. |
void |
computeEvaluationMode()
|
SequenceType |
getArgumentType(int n)
Get the required types of an argument to this function |
int |
getEvaluationMode()
Get the evaluation mode |
int |
getFunctionNameCode()
Get the namepool name code of the function |
InstructionInfo |
getInstructionInfo()
Get the InstructionInfo details about the construct. |
int |
getNumberOfArguments()
Get the arity of this function |
UserFunctionParameter[] |
getParameterDefinitions()
|
SequenceType |
getResultType()
Get the type of value returned by this function |
boolean |
isTailRecursive()
|
void |
process(ValueRepresentation[] actualArgs,
XPathContextMajor context)
Call this function in "push" mode, writing the results to the current output destination. |
void |
setFunctionNameCode(int nameCode)
Set the namepool name code of the function |
void |
setMemoFunction(boolean isMemo)
Mark this function as a memo function (or not) |
void |
setParameterDefinitions(UserFunctionParameter[] params)
|
void |
setResultType(SequenceType resultType)
|
void |
setTailRecursive(boolean tailCalls)
|
Methods inherited from class net.sf.saxon.instruct.Procedure |
getBody, getColumnNumber, getExecutable, getHostLanguage, getLineNumber, getLineNumber, getLocationProvider, getPublicId, getStackFrameMap, getSystemId, getSystemId, replaceSubExpression, setBody, setExecutable, setHostLanguage, setLineNumber, setStackFrameMap, setSystemId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UserFunction()
public UserFunction(Expression body)
Method Detail |
public void computeEvaluationMode()
public void setParameterDefinitions(UserFunctionParameter[] params)
public UserFunctionParameter[] getParameterDefinitions()
public void setResultType(SequenceType resultType)
public void setTailRecursive(boolean tailCalls)
public boolean isTailRecursive()
public SequenceType getResultType()
public SequenceType getArgumentType(int n)
n
- identifies the argument in question, starting at 0
public int getEvaluationMode()
public int getNumberOfArguments()
public void setMemoFunction(boolean isMemo)
isMemo
- true if this is a memo functionpublic void setFunctionNameCode(int nameCode)
nameCode
- represents the function namepublic int getFunctionNameCode()
public ValueRepresentation call(ValueRepresentation[] actualArgs, XPathContextMajor context) throws XPathException
actualArgs
- the arguments supplied to the function. These must have the correct
types required by the function signature (it is the caller's responsibility to check this).
It is acceptable to supply a Closure
to represent a value whose
evaluation will be delayed until it is needed. The array must be the correct size to match
the number of arguments: again, it is the caller's responsibility to check this.context
- This provides the run-time context for evaluating the function. It is the caller's
responsibility to allocate a "clean" context for the function to use; the context that is provided
will be overwritten by the function.
XPathException
public void process(ValueRepresentation[] actualArgs, XPathContextMajor context) throws XPathException
actualArgs
- the arguments supplied to the function. These must have the correct
types required by the function signature (it is the caller's responsibility to check this).
It is acceptable to supply a Closure
to represent a value whose
evaluation will be delayed until it is needed. The array must be the correct size to match
the number of arguments: again, it is the caller's responsibility to check this.context
- This provides the run-time context for evaluating the function. It is the caller's
responsibility to allocate a "clean" context for the function to use; the context that is provided
will be overwritten by the function.
XPathException
public ValueRepresentation call(ValueRepresentation[] actualArgs, Controller controller) throws XPathException
actualArgs
- the arguments supplied to the function. These must have the correct
types required by the function signature (it is the caller's responsibility to check this).
It is acceptable to supply a Closure
to represent a value whose
evaluation will be delayed until it is needed. The array must be the correct size to match
the number of arguments: again, it is the caller's responsibility to check this.controller
- This provides the run-time context for evaluating the function. A Controller
may be obtained by calling XQueryExpression.newController()
. This may
be used for a series of calls on functions defined in the same module as the XQueryExpression.
XPathException
public InstructionInfo getInstructionInfo()
getInstructionInfo
in interface InstructionInfoProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |