Class MemoFunction

All Implemented Interfaces:
SourceLocator, Callable, ContextOriginator, ExpressionOwner, Locatable, FunctionDefinition, FunctionItem, GroundedValue, Item, Sequence, Location, Traceable, TraceableComponent, 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.
  • Constructor Details

    • MemoFunction

      public MemoFunction()
  • Method Details

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