| 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.util; |
| 9 | |
| 10 | |
| 11 | import net.sf.saxon.om.NodeInfo; |
| 12 | |
| 13 | /** |
| 14 | * This interface can be implemented by an implementation of NodeInfo to take advantage of a generic implementation |
| 15 | * of the descendant axis found in class {@link net.sf.saxon.tree.util.SteppingNavigator} |
| 16 | */ |
| 17 | public interface SteppingNode<N extends SteppingNode> extends NodeInfo { |
| 18 | |
| 19 | /** |
| 20 | * Get the parent of this node |
| 21 | * |
| 22 | * @return the parent of this node; or null if it is the root of the tree |
| 23 | */ |
| 24 | |
| 25 | N getParent(); |
| 26 | |
| 27 | /** |
| 28 | * Get the next sibling of this node |
| 29 | * |
| 30 | * @return the next sibling if there is one, or null otherwise |
| 31 | */ |
| 32 | N getNextSibling(); |
| 33 | |
| 34 | /** |
| 35 | * Get the previous sibling of this node |
| 36 | * |
| 37 | * @return the previous sibling if there is one, or null otherwise |
| 38 | */ |
| 39 | |
| 40 | N getPreviousSibling(); |
| 41 | |
| 42 | /** |
| 43 | * Get the first child of this node |
| 44 | * |
| 45 | * @return the first child if there is one, or null otherwise |
| 46 | */ |
| 47 | |
| 48 | N getFirstChild(); |
| 49 | |
| 50 | /** |
| 51 | * Find the next matching element in document order; that is, the first child element |
| 52 | * with the required name if there is one; otherwise the next sibling element |
| 53 | * if there is one; otherwise the next sibling element of the parent, grandparent, etc, up to the anchor element. |
| 54 | * |
| 55 | * @param anchor the root of the tree within which navigation is confined |
| 56 | * @param uri the required namespace URI, or null if any namespace is acceptable |
| 57 | * @param local the required local name, or null if any local name is acceptable |
| 58 | * @return the next element after this one in document order, with the given URI and local name |
| 59 | * if specified, or null if this is the last node in the document, or the last node |
| 60 | * within the subtree being navigated |
| 61 | */ |
| 62 | |
| 63 | N getSuccessorElement(N anchor, String uri, String local); |
| 64 | |
| 65 | } |
| 66 |