Debian Codegraph @

src/com/adobe/internal/xmp/impl/xpath/XMPPathSegment.java

raw symbols SCIP
1 // =================================================================================================
2 // ADOBE SYSTEMS INCORPORATED
3 // Copyright 2006 Adobe Systems Incorporated
4 // All Rights Reserved
5 //
6 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
7 // of the Adobe license agreement accompanying it.
8 // =================================================================================================
9
10 package com.adobe.internal.xmp.impl.xpath;
11
12
13 /**
14 * A segment of a parsed <code>XMPPath</code>.
15 *
16 * @author Stefan Makswit
17 * @version $Revision$
18 * @since 23.06.2006
19 */
20 public class XMPPathSegment
21 {
22 /** name of the path segment */
23 private String name;
24 /** kind of the path segment */
25 private int kind;
26 /** flag if segment is an alias */
27 private boolean alias;
28 /** alias form if applicable */
29 private int aliasForm;
30
31
32 /**
33 * Constructor with initial values.
34 *
35 * @param name the name of the segment
36 */
37 public XMPPathSegment(String name)
38 {
39 this.name = name;
40 }
41
42
43 /**
44 * Constructor with initial values.
45 *
46 * @param name the name of the segment
47 * @param kind the kind of the segment
48 */
49 public XMPPathSegment(String name, int kind)
50 {
51 this.name = name;
52 this.kind = kind;
53 }
54
55
56 /**
57 * @return Returns the kind.
58 */
59 public int getKind()
60 {
61 return kind;
62 }
63
64
65 /**
66 * @param kind The kind to set.
67 */
68 public void setKind(int kind)
69 {
70 this.kind = kind;
71 }
72
73
74 /**
75 * @return Returns the name.
76 */
77 public String getName()
78 {
79 return name;
80 }
81
82
83 /**
84 * @param name The name to set.
85 */
86 public void setName(String name)
87 {
88 this.name = name;
89 }
90
91
92 /**
93 * @param alias the flag to set
94 */
95 public void setAlias(boolean alias)
96 {
97 this.alias = alias;
98 }
99
100
101 /**
102 * @return Returns the alias.
103 */
104 public boolean isAlias()
105 {
106 return alias;
107 }
108
109
110 /**
111 * @return Returns the aliasForm if this segment has been created by an alias.
112 */
113 public int getAliasForm()
114 {
115 return aliasForm;
116 }
117
118
119 /**
120 * @param aliasForm the aliasForm to set
121 */
122 public void setAliasForm(int aliasForm)
123 {
124 this.aliasForm = aliasForm;
125 }
126
127
128 /**
129 * @see Object#toString()
130 */
131 public String toString()
132 {
133 switch (kind)
134 {
135 case XMPPath.STRUCT_FIELD_STEP:
136 case XMPPath.ARRAY_INDEX_STEP:
137 case XMPPath.QUALIFIER_STEP:
138 case XMPPath.ARRAY_LAST_STEP:
139 return name;
140 case XMPPath.QUAL_SELECTOR_STEP:
141 case XMPPath.FIELD_SELECTOR_STEP:
142 return name;
143
144 default:
145 // no defined step
146 return name;
147 }
148 }
149 }