Debian Codegraph @

net/sf/saxon/tree/iter/GroundedIterator.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.tree.iter;
9
10 import net.sf.saxon.om.GroundedValue;
11 import net.sf.saxon.om.Item;
12 import net.sf.saxon.om.SequenceIterator;
13 import net.sf.saxon.trans.XPathException;
14
15 /**
16 * This interface is an extension to the SequenceIterator interface; it represents
17 * a SequenceIterator that is based on an in-memory representation of a sequence,
18 * and that is therefore capable of returning a Sequence containing all the items
19 * in the sequence.
20 *
21 * <p>We stretch the concept to consider an iterator over a MemoClosure as a grounded
22 * iterator, on the basis that the in-memory sequence might exist already or might
23 * be created as a side-effect of navigating the iterator. This is why materializing
24 * the iterator can raise an exception.</p>
25 */
26
27 public interface GroundedIterator<T extends Item<?>> extends SequenceIterator<T> {
28
29 /**
30 * Return a GroundedValue containing all the items in the sequence returned by this
31 * SequenceIterator. This should be an "in-memory" value, not a Closure. This method
32 * does not change the state of the iterator (in particular, it does not consume the
33 * iterator).
34 *
35 * @return the corresponding Value
36 * @throws XPathException in the cases of subclasses (such as the iterator over a MemoClosure)
37 * which cause evaluation of expressions while materializing the value.
38 */
39
40 GroundedValue<T> materialize() throws XPathException;
41
42 /**
43 * Return a GroundedValue containing all the remaining items in the sequence returned by this
44 * SequenceIterator, starting at the current position. This should be an "in-memory" value, not a
45 * Closure. This method does not change the state of the iterator (in particular, it does not
46 * consume the iterator).
47 *
48 * @return the corresponding Value
49 * @throws XPathException in the cases of subclasses (such as the iterator over a MemoClosure)
50 * which cause evaluation of expressions while materializing the value.
51 */
52
53 GroundedValue<T> getResidue() throws XPathException;
54 }
55