Class DocumentSorterAdjunct

  • All Implemented Interfaces:
    FeedMaker

    public class DocumentSorterAdjunct
    extends TransmissionAdjunct
    implements FeedMaker
    Generate streaming code for a document sorting expression node. This will only be used to support streaming of a path expression of the form child::* / ancestor::*, where the only operation needed is filtering to remove duplicate ancestors (and returning of ancestors in document order). In addition, if the expression a mixture of striding and grounded nodes, then we can sort it because the streamed nodes retain their order (bug 29507)
    • Constructor Detail

      • DocumentSorterAdjunct

        public DocumentSorterAdjunct()
    • Method Detail

      • computeStreamability

        public PostureAndSweep computeStreamability​(ContextItemStaticInfoEE contextInfo,
                                                    java.util.List<java.lang.String> reasons)
        Compute the posture and sweep of this expression as defined in the W3C streamability specifications. This must be implemented in all subclasses that don't use the general streamability rules.
        Overrides:
        computeStreamability in class StreamingAdjunct
        Parameters:
        contextInfo - Information about the context item type and posture
        reasons - the caller may supply a list, in which case the implementation may add to this
        Returns:
        the posture and sweep of the expression
      • toStreamingPattern

        public Pattern toStreamingPattern​(Configuration config)
        Convert this expression to a streaming pattern (a pattern used internally to match nodes during push processing of an event stream)
        Overrides:
        toStreamingPattern in class StreamingAdjunct
        Parameters:
        config - the Saxon configuration
        Returns:
        the equivalent pattern if conversion succeeds; otherwise null
      • getWatchMaker

        public WatchMaker getWatchMaker​(boolean forGrouping)
                                 throws XPathException
        Description copied from class: StreamingAdjunct
        Get a WatchMaker, a factory class that creates a Watch to evaluate this expression in streaming mode. This method will only be called if the getImplementationMethod() method of the expression includes the value Expression.WATCH_METHOD
        Overrides:
        getWatchMaker in class TransmissionAdjunct
        Parameters:
        forGrouping - true if the selected items are being grouped
        Returns:
        a Watchmaker to evaluate the expression, or null if it is not streamable with respect to the specificed argument.
        Throws:
        XPathException - in the event of a failure
      • getFeedMaker

        public FeedMaker getFeedMaker​(int arg)
                               throws XPathException
        Description copied from class: StreamingAdjunct
        Get a FeedMaker, a factory class that creates a Feed to evaluate this expression in streaming mode. In many cases the StreamingAdjunct is itself a FeedMaker, in which case it returns itself. But where an expression has several operands, it will typically create different feeds depending on which argument is the streamed input, and in such cases the individual StreamingAdjunct makes the decision which feed to use, by returning an appropriate FeedMaker.
        Overrides:
        getFeedMaker in class StreamingAdjunct
        Parameters:
        arg - identifies the argument with respect to which the expression is to be inverted: usually 0 to indicate the first argument is the value that is streamed. Argument numbering is the same as the sequence of arguments/operands returned by the method Expression.operands()
        Returns:
        a FeedMaker to evaluate the expression, or null if it is not streamable with respect to the specificed argument.
        Throws:
        XPathException - in the event of a failure