Package net.sf.saxon.expr.instruct
Class MemoFunction
- java.lang.Object
-
- net.sf.saxon.expr.instruct.Actor
-
- net.sf.saxon.expr.instruct.UserFunction
-
- net.sf.saxon.expr.instruct.MemoFunction
-
- All Implemented Interfaces:
javax.xml.transform.SourceLocator
,Callable
,ContextOriginator
,ExpressionOwner
,Locatable
,FunctionDefinition
,FunctionItem
,GroundedValue
,Item
,Sequence
,Location
,Traceable
,TraceableComponent
,org.xml.sax.Locator
public class MemoFunction extends UserFunction
A user-defined function that is declared as a memo function, meaning that it remembers results of previous calls.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemoFunction.NodeSurrogate
A NodeSurrogate is a value that represents a node; it encapsulates a Java function that can be called to test whether a particular node is the one that it represents.-
Nested classes/interfaces inherited from class net.sf.saxon.expr.instruct.UserFunction
UserFunction.Determinism
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.UserFunction
bodyEvaluator, pushEvaluator
-
-
Constructor Summary
Constructors Constructor Description MemoFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequence
call(XPathContext context, Sequence[] actualArgs)
Call this function to return a value.void
computeEvaluationMode()
Determine the preferred evaluation mode for this functionboolean
isMemoFunction()
Ask whether this function is a memo functionvoid
setParameterDefinitions(UserFunctionParameter[] params)
Set the definitions of the declared parameters for this function.-
Methods inherited from class net.sf.saxon.expr.instruct.UserFunction
acceptsNodesWithoutAtomization, atomize, call, callUpdating, containsTailCalls, deepEqual40, deepEquals, effectiveBooleanValue, export, gatherProperties, getAnnotations, getArgumentType, getArity, getBodyEvaluator, getDeclaredResultType, getDeclaredStreamability, getDefaultValueExpression, getDescription, getDeterminism, getFunctionItemType, getFunctionItemType, getFunctionName, getLength, getMinimumArity, getNumberOfParameters, getObjectName, getOperandRoles, getParameterDefinitions, getParameterName, getPositionOfParameter, getReferenceCount, getResultType, getSymbolicName, getTracingTag, getUnicodeStringValue, head, incrementReferenceCount, isArray, isExportable, isInlineable, isMap, isOverrideExtensionFunction, isTailRecursive, isTrustedResultType, isUpdating, itemAt, makeExpandedArgumentArray, makeNewContext, markAsInlined, prepareForStreaming, process, reduce, setAnnotations, setArityRange, setBodyEvaluator, setDeclaredStreamability, setDeterminism, setFunctionName, setInlineable, setIxslUpdating, setMinimumArity, setOverrideExtensionFunction, setResultType, setTailRecursive, setUpdating, subsequence, typeCheck
-
Methods inherited from class net.sf.saxon.expr.instruct.Actor
allocateAllBindingSlots, allocateBindingSlotsRecursive, getBody, getChildExpression, getColumnNumber, getComponentName, getDeclaredVisibility, getDeclaringComponent, getLineNumber, getLocation, getPackageData, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, makeDeclaringComponent, obtainDeclaringComponent, process, saveLocation, setBody, setChildExpression, setColumnNumber, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.FunctionItem
getGenre, isSequenceVariadic, toShortString
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getStringValue, isStreamed, iterate
-
Methods inherited from interface net.sf.saxon.expr.Locatable
getLocation
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Methods inherited from interface net.sf.saxon.trace.TraceableComponent
getBody, setBody
-
-
-
-
Method Detail
-
setParameterDefinitions
public void setParameterDefinitions(UserFunctionParameter[] params)
Description copied from class:UserFunction
Set the definitions of the declared parameters for this function. Note that at the time this is called, full analysis of the xsl:param element is yet to be done.- Overrides:
setParameterDefinitions
in classUserFunction
- Parameters:
params
- an array of parameter definitions
-
computeEvaluationMode
public void computeEvaluationMode()
Determine the preferred evaluation mode for this function- Overrides:
computeEvaluationMode
in classUserFunction
-
isMemoFunction
public boolean isMemoFunction()
Ask whether this function is a memo function- Overrides:
isMemoFunction
in classUserFunction
- Returns:
- true if this function is marked as a memo function
-
call
public Sequence call(XPathContext context, Sequence[] actualArgs) throws XPathException
Call this function to return a value.- Specified by:
call
in interfaceCallable
- Overrides:
call
in classUserFunction
- Parameters:
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 aClosure
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.- Returns:
- a Value representing the result of the function.
- Throws:
XPathException
- if a dynamic error occurs while evaluating the function
-
-