Class Sum.SumFold

  • All Implemented Interfaces:
    Fold
    Enclosing class:
    Sum

    public static class Sum.SumFold
    extends java.lang.Object
    implements Fold
    Implementation of Fold class to do the summation in push mode
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isFinished()
      Ask whether the computation has completed.
      void processItem​(Item item)
      Process one item in the input sequence, returning a new copy of the working data
      Sequence result()
      Compute the final result of the function, when all the input has been processed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • processItem

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

        public 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.
        Specified by:
        isFinished in interface Fold
        Returns:
        true if the result of the function is now available even though not all items in the sequence have been processed
      • result

        public Sequence result()
        Compute the final result of the function, when all the input has been processed
        Specified by:
        result in interface Fold
        Returns:
        the result of the function