Interface Fold

All Known Implementing Classes:
FoldLeftFn.FoldLeftFold, Sum.SumFold

public interface Fold
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Ask whether the computation has completed.
    void
    Process one item in the input sequence, returning a new copy of the working data
    Compute the final result of the function, when all the input has been processed
  • Method Details

    • processItem

      void processItem(Item item) throws XPathException
      Process one item in the input sequence, returning a new copy of the working data
      Parameters:
      item - the item to be processed from the input sequence
      Throws:
      XPathException - if a dynamic error occurs
    • isFinished

      boolean isFinished()
      Ask whether the computation has completed. A function that can deliver its final result without reading the whole input should return true; this will be followed by a call on result() to deliver the final result.
      Returns:
      true if the result of the function is now available even though not all items in the sequence have been processed
    • result

      Sequence result() throws XPathException
      Compute the final result of the function, when all the input has been processed
      Returns:
      the result of the function
      Throws:
      XPathException - if a dynamic error occurs