Debian Codegraph @

net/sf/saxon/expr/sort/GroupIterator.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.expr.sort;
9
10 import com.saxonica.ee.stream.ManualGroupIterator;
11 import net.sf.saxon.expr.XPathContext;
12 import net.sf.saxon.om.AtomicSequence;
13 import net.sf.saxon.om.Item;
14 import net.sf.saxon.om.SequenceIterator;
15 import net.sf.saxon.trans.XPathException;
16
17 /**
18 * A GroupIterator is an iterator that iterates over a sequence of groups.
19 * The normal methods such as next() and current() always deliver the leading item
20 * of the group. Additional methods are available to get the grouping key for the
21 * current group (only applicable to group-by and group-adjacent), and to get all the
22 * members of the current group.
23 */
24
25 public interface GroupIterator extends SequenceIterator<Item<?>> {
26
27 /**
28 * Get the grouping key of the current group
29 *
30 * @return the current grouping key in the case of group-by or group-adjacent,
31 * or null in the case of group-starting-with and group-ending-with
32 */
33
34 /*@Nullable*/
35 AtomicSequence getCurrentGroupingKey();
36
37 /**
38 * Get an iterator over the members of the current group, in population
39 * order. This must always be a clean iterator, that is, an iterator that
40 * starts at the first item of the group.
41 *
42 * @return an iterator over all the members of the current group, in population
43 * order.
44 * @throws net.sf.saxon.trans.XPathException
45 * if a dynamic error occurs
46 */
47
48 SequenceIterator<?> iterateCurrentGroup() throws XPathException;
49
50 //#if EE==true
51
52 /**
53 * Get a sequence which is a snapshot of this sequence at the current position
54 */
55 ManualGroupIterator getSnapShot(XPathContext context) throws XPathException;
56
57 //#endif
58 }
59