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`, `Function`, `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/interfaces inherited from class net.sf.saxon.expr.instruct.UserFunction

      `UserFunction.Determinism`

  - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.instruct.UserFunction

      `evaluator`

    - ### Fields inherited from class net.sf.saxon.expr.instruct.Actor

      `body`

  - ### 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 function
    `boolean` | `isMemoFunction()` | Ask whether this function is a memo function

    - ### Methods inherited from class net.sf.saxon.expr.instruct.UserFunction

      `acceptsNodesWithoutAtomization, atomize, call, callUpdating, containsTailCalls, deepEquals, effectiveBooleanValue, export, gatherProperties, getAnnotations, getArgumentType, getArity, getDeclaredResultType, getDeclaredStreamability, getDescription, getDeterminism, getEvaluator, getFunctionItemType, getFunctionName, getLength, getObjectName, getOperandRoles, getParameterDefinitions, getReferenceCount, getResultType, getStringValue, getStringValueCS, getSymbolicName, getTracingTag, head, incrementReferenceCount, isArray, isExportable, isInlineable, isMap, isOverrideExtensionFunction, isTailRecursive, isTrustedResultType, isUpdating, itemAt, makeNewContext, markAsInlined, prepareForStreaming, process, reduce, setAnnotations, setDeclaredStreamability, setDeterminism, setEvaluationMode, setFunctionName, setInlineable, setOverrideExtensionFunction, setParameterDefinitions, 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, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, makeDeclaringComponent, obtainDeclaringComponent, 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.Function

      `getGenre, toShortString`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `asIterable, concatenate, containsNode, materialize`

    - ### Methods inherited from interface net.sf.saxon.om.Item

      `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`

- - ### 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 Sequence call​(XPathContext context,
                               Sequence[] actualArgs)
                        throws XPathException

      Call this function to return a value.
      Specified by:
        `call` in interface `Callable`
      Specified by:
        `call` in interface `Function`
      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