01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.xml.xpath.ext;
21:
22: /**
23: * Be aware the following:
24: * - The "." is not a short form of self axis!
25: * - The ".." is not a short form of parent axis!
26: * They are not the axis at all but rather the abbreviated location steps.
27: *
28: * @author nk160297
29: */
30: public enum XPathAxis {
31: SELF(null, "self"), // NOI18N
32: CHILD("", "child"), // NOI18N
33: PARENT(null, "parent"), // NOI18N
34: ANCESTOR(null, "ancestor"), // NOI18N
35: ATTRIBUTE("@", "attribute"), // NOI18N
36: NAMESPACE(null, "namespace"), // NOI18N
37: PRECEDING(null, "preceding"), // NOI18N
38: FOLLOWING(null, "following"), // NOI18N
39: DESCENDANT(null, "descendant"), // NOI18N
40: ANCESTOR_OR_SELF(null, "ancestor-or-self"), // NOI18N
41: DESCENDANT_OR_SELF(null, "descendant-or-self"), // NOI18N
42: FOLLOWING_SIBLING(null, "following-sibling"), // NOI18N
43: PRECEDING_SIBLING(null, "preceding-sibling"); // NOI18N
44:
45: private String mAbbreviatedName;
46: private String mFullName;
47:
48: XPathAxis(String abbreviatedName, String fullName) {
49: mAbbreviatedName = abbreviatedName;
50: mFullName = fullName;
51: }
52:
53: public String getShortForm() {
54: if (mAbbreviatedName != null) {
55: return mAbbreviatedName;
56: } else {
57: return mFullName + "::";
58: }
59: }
60:
61: public String getLongForm() {
62: if (mFullName != null) {
63: return mFullName + "::";
64: } else {
65: return mAbbreviatedName;
66: }
67: }
68:
69: public String getAbbreviatedName() {
70: return mAbbreviatedName;
71: }
72:
73: public String getFullName() {
74: return mFullName;
75: }
76: }
|