| 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.tiny; |
| 9 | |
| 10 | import net.sf.saxon.om.NodeInfo; |
| 11 | import net.sf.saxon.pattern.NodeTest; |
| 12 | import net.sf.saxon.type.Type; |
| 13 | |
| 14 | /** |
| 15 | * Interface defining methods common to the TinyTree and the Domino tree model. These two models are |
| 16 | * recognized by the {@link NodeTest} class, which is able to match nodes without actually instantiating |
| 17 | * the NodeInfo object |
| 18 | */ |
| 19 | public interface NodeVectorTree { |
| 20 | |
| 21 | /** |
| 22 | * Ask whether the tree contains non-trivial type information (from schema validation) |
| 23 | * @return true if type information is present |
| 24 | */ |
| 25 | boolean isTyped(); |
| 26 | |
| 27 | /** |
| 28 | * Construct a NodeInfo representing the node at a given position in the tree |
| 29 | * @param nodeNr the node number in the tree |
| 30 | * @return the constructed NodeInfo |
| 31 | */ |
| 32 | |
| 33 | NodeInfo getNode(int nodeNr); |
| 34 | |
| 35 | /** |
| 36 | * Get the kind of node at a given position in the tree |
| 37 | * @param nodeNr the node number |
| 38 | * @return the kind of node, for example {@link Type#ELEMENT} |
| 39 | */ |
| 40 | |
| 41 | int getNodeKind(int nodeNr); |
| 42 | |
| 43 | /** |
| 44 | * Get the integer fingerprint of the node at a given position in the tree |
| 45 | * |
| 46 | * @param nodeNr the node number |
| 47 | * @return the fingerprint of the node, as registered in the NamePool. -1 for an unnamed node. |
| 48 | */ |
| 49 | |
| 50 | int getFingerprint(int nodeNr); |
| 51 | |
| 52 | |
| 53 | |
| 54 | byte[] getNodeKindArray(); |
| 55 | |
| 56 | int[] getNameCodeArray(); |
| 57 | |
| 58 | |
| 59 | } |
| 60 | |
| 61 | // Copyright (c) 2018 Saxonica Limited |
| 62 |