com.saxonica.expr
Class MemoFunction

java.lang.Object
  extended by net.sf.saxon.expr.instruct.Procedure
      extended by net.sf.saxon.expr.instruct.UserFunction
          extended by com.saxonica.expr.MemoFunction
All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, Container, InstructionInfo, 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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.instruct.UserFunction
evaluationMode
 
Fields inherited from class net.sf.saxon.expr.instruct.Procedure
body
 
Constructor Summary
MemoFunction()
           
 
Method Summary
 ValueRepresentation call(ValueRepresentation[] actualArgs, XPathContextMajor context)
          Call this function to return a value.
 void computeEvaluationMode()
          Determine the preferred evaluation mode for this function
 boolean isMemoFunction()
          Ask whether this function is a memo function
 
Methods inherited from class net.sf.saxon.expr.instruct.UserFunction
call, callUpdating, containsTailCalls, gatherDirectContributingCallees, getArgumentType, getConstructType, getDeclaredResultType, getEvaluationMode, getFunctionName, getNumberOfArguments, getObjectName, getParameterDefinitions, getResultType, isInlineable, isTailRecursive, isUpdating, iterateEvents, process, setFunctionName, setInlineable, setParameterDefinitions, setResultType, setTailRecursive, setUpdating
 
Methods inherited from class net.sf.saxon.expr.instruct.Procedure
getBody, getColumnNumber, getColumnNumber, getContainerGranularity, getExecutable, getHostLanguage, getLineNumber, getLineNumber, getLocationProvider, getProperties, getProperty, getPublicId, getStackFrameMap, getSystemId, getSystemId, 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

MemoFunction

public MemoFunction()
Method Detail

computeEvaluationMode

public void computeEvaluationMode()
Determine the preferred evaluation mode for this function

Overrides:
computeEvaluationMode in class UserFunction

isMemoFunction

public boolean isMemoFunction()
Ask whether this function is a memo function

Overrides:
isMemoFunction in class UserFunction
Returns:
true if this function is marked as a memo function

call

public ValueRepresentation call(ValueRepresentation[] actualArgs,
                                XPathContextMajor context)
                         throws XPathException
Call this function to return a value.

Overrides:
call in class UserFunction
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 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.
Returns:
a Value representing the result of the function.
Throws:
XPathException - if a dynamic error occurs while evaluating the function


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.