| 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.Item; |
| 11 | import net.sf.saxon.om.SequenceIterator; |
| 12 | |
| 13 | |
| 14 | /** |
| 15 | * A SequenceIterator is used to iterate over a sequence. A LookaheadIterator |
| 16 | * is one that supports a hasNext() method to determine if there are more nodes |
| 17 | * after the current node. |
| 18 | */ |
| 19 | |
| 20 | public interface LookaheadIterator<T extends Item<?>> extends SequenceIterator<T> { |
| 21 | |
| 22 | /** |
| 23 | * Determine whether there are more items to come. Note that this operation |
| 24 | * is stateless and it is not necessary (or usual) to call it before calling |
| 25 | * next(). It is used only when there is an explicit need to tell if we |
| 26 | * are at the last element. |
| 27 | * <p>This method must not be called unless the result of getProperties() on the iterator |
| 28 | * includes the bit setting {@link SequenceIterator#LOOKAHEAD} </p> |
| 29 | * |
| 30 | * @return true if there are more items in the sequence |
| 31 | */ |
| 32 | |
| 33 | boolean hasNext(); |
| 34 | |
| 35 | |
| 36 | } |
| 37 |