| 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.NodeInfo; |
| 11 | import net.sf.saxon.trans.XPathException; |
| 12 | |
| 13 | /** |
| 14 | * An iterator over nodes, that prepends a given node to the nodes |
| 15 | * returned by another iterator. Used to modify an iterator over axis A |
| 16 | * to one that iterates over A-OR-SELF. |
| 17 | */ |
| 18 | |
| 19 | public class PrependAxisIterator extends PrependSequenceIterator<NodeInfo> implements AxisIterator { |
| 20 | |
| 21 | |
| 22 | public PrependAxisIterator(NodeInfo start, AxisIterator base) { |
| 23 | super(start, base); |
| 24 | } |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * Get the next item in the sequence. <BR> |
| 29 | * |
| 30 | * @return the next Item. If there are no more nodes, return null. |
| 31 | */ |
| 32 | |
| 33 | /*@Nullable*/ |
| 34 | public NodeInfo next() { |
| 35 | try { |
| 36 | return super.next(); |
| 37 | } catch (XPathException e) { |
| 38 | throw new AssertionError(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | |
| 43 | } |
| 44 |