| 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.s9api; |
| 9 | |
| 10 | import net.sf.saxon.om.AxisInfo; |
| 11 | |
| 12 | /** |
| 13 | * This is an enumeration class containing constants representing the thirteen XPath axes |
| 14 | */ |
| 15 | public enum Axis { |
| 16 | ANCESTOR(AxisInfo.ANCESTOR), |
| 17 | ANCESTOR_OR_SELF(AxisInfo.ANCESTOR_OR_SELF), |
| 18 | ATTRIBUTE(AxisInfo.ATTRIBUTE), |
| 19 | CHILD(AxisInfo.CHILD), |
| 20 | DESCENDANT(AxisInfo.DESCENDANT), |
| 21 | DESCENDANT_OR_SELF(AxisInfo.DESCENDANT_OR_SELF), |
| 22 | FOLLOWING(AxisInfo.FOLLOWING), |
| 23 | FOLLOWING_SIBLING(AxisInfo.FOLLOWING_SIBLING), |
| 24 | PARENT(AxisInfo.PARENT), |
| 25 | PRECEDING(AxisInfo.PRECEDING), |
| 26 | PRECEDING_SIBLING(AxisInfo.PRECEDING_SIBLING), |
| 27 | SELF(AxisInfo.SELF), |
| 28 | NAMESPACE(AxisInfo.NAMESPACE); |
| 29 | |
| 30 | private byte number; |
| 31 | |
| 32 | /** |
| 33 | * Create an Axis |
| 34 | * |
| 35 | * @param number the internal axis number as defined in class {@link net.sf.saxon.om.AxisInfo} |
| 36 | */ |
| 37 | |
| 38 | private Axis(byte number) { |
| 39 | this.number = number; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get the axis number, as defined in class {@link net.sf.saxon.om.AxisInfo} |
| 44 | * |
| 45 | * @return the axis number |
| 46 | */ |
| 47 | public byte getAxisNumber() { |
| 48 | return number; |
| 49 | } |
| 50 | } |
| 51 |