KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > util > ConstantPoolEntry


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.util;
12
13 import org.eclipse.jdt.core.util.IConstantPoolEntry;
14
15 /**
16  * Default implementation of IConstantPoolEntry
17  *
18  * @since 2.0
19  */

20 public class ConstantPoolEntry implements IConstantPoolEntry {
21
22     private int kind;
23     private int classInfoNameIndex;
24     private int classIndex;
25     private int nameAndTypeIndex;
26     private int stringIndex;
27     private char[] stringValue;
28     private int integerValue;
29     private float floatValue;
30     private double doubleValue;
31     private long longValue;
32     private int nameAndTypeDescriptorIndex;
33     private int nameAndTypeNameIndex;
34     private char[] className;
35     private char[] fieldName;
36     private char[] methodName;
37     private char[] fieldDescriptor;
38     private char[] methodDescriptor;
39     private char[] utf8Value;
40     private int utf8Length;
41     private char[] classInfoName;
42     
43     public ConstantPoolEntry() {
44         this.classInfoNameIndex = -1;
45         this.classIndex = -1;
46         this.nameAndTypeIndex = -1;
47         this.stringIndex = -1;
48         this.stringValue = null;
49         this.integerValue = -1;
50         this.floatValue = -0.0f;
51         this.doubleValue = -0-0;
52         this.longValue = -1;
53         this.nameAndTypeDescriptorIndex = -1;
54         this.nameAndTypeNameIndex = -1;
55         this.className = null;
56         this.fieldName = null;
57         this.methodName = null;
58         this.fieldDescriptor = null;
59         this.methodDescriptor = null;
60         this.utf8Value = null;
61         this.utf8Length = -1;
62         this.classInfoName = null;
63     }
64     
65     /**
66      * @see IConstantPoolEntry#getKind()
67      */

68     public int getKind() {
69         return this.kind;
70     }
71
72     /**
73      * Sets the kind.
74      * @param kind The kind to set
75      */

76     public void setKind(int kind) {
77         this.kind = kind;
78     }
79
80     /**
81      * @see IConstantPoolEntry#getClassInfoNameIndex()
82      */

83     public int getClassInfoNameIndex() {
84         return this.classInfoNameIndex;
85     }
86
87     /**
88      * @see IConstantPoolEntry#getClassIndex()
89      */

90     public int getClassIndex() {
91         return this.classIndex;
92     }
93
94     /**
95      * @see IConstantPoolEntry#getNameAndTypeIndex()
96      */

97     public int getNameAndTypeIndex() {
98         return this.nameAndTypeIndex;
99     }
100
101     /**
102      * @see IConstantPoolEntry#getStringIndex()
103      */

104     public int getStringIndex() {
105         return this.stringIndex;
106     }
107
108     /**
109      * @see IConstantPoolEntry#getStringValue()
110      */

111     public String JavaDoc getStringValue() {
112         return new String JavaDoc(this.stringValue);
113     }
114
115     /**
116      * @see IConstantPoolEntry#getIntegerValue()
117      */

118     public int getIntegerValue() {
119         return this.integerValue;
120     }
121
122     /**
123      * @see IConstantPoolEntry#getFloatValue()
124      */

125     public float getFloatValue() {
126         return this.floatValue;
127     }
128
129     /**
130      * @see IConstantPoolEntry#getDoubleValue()
131      */

132     public double getDoubleValue() {
133         return this.doubleValue;
134     }
135
136     /**
137      * @see IConstantPoolEntry#getLongValue()
138      */

139     public long getLongValue() {
140         return this.longValue;
141     }
142
143     /**
144      * @see IConstantPoolEntry#getNameAndTypeInfoDescriptorIndex()
145      */

146     public int getNameAndTypeInfoDescriptorIndex() {
147         return this.nameAndTypeDescriptorIndex;
148     }
149
150     /**
151      * @see IConstantPoolEntry#getNameAndTypeInfoNameIndex()
152      */

153     public int getNameAndTypeInfoNameIndex() {
154         return this.nameAndTypeNameIndex;
155     }
156
157     /**
158      * @see IConstantPoolEntry#getClassName()
159      */

160     public char[] getClassName() {
161         return this.className;
162     }
163
164     /**
165      * @see IConstantPoolEntry#getFieldName()
166      */

167     public char[] getFieldName() {
168         return this.fieldName;
169     }
170
171     /**
172      * @see IConstantPoolEntry#getMethodName()
173      */

174     public char[] getMethodName() {
175         return this.methodName;
176     }
177
178     /**
179      * @see IConstantPoolEntry#getFieldDescriptor()
180      */

181     public char[] getFieldDescriptor() {
182         return this.fieldDescriptor;
183     }
184
185     /**
186      * @see IConstantPoolEntry#getMethodDescriptor()
187      */

188     public char[] getMethodDescriptor() {
189         return this.methodDescriptor;
190     }
191
192     /**
193      * @see IConstantPoolEntry#getUtf8Value()
194      */

195     public char[] getUtf8Value() {
196         return this.utf8Value;
197     }
198
199     /**
200      * @see IConstantPoolEntry#getClassInfoName()
201      */

202     public char[] getClassInfoName() {
203         return this.classInfoName;
204     }
205
206     /**
207      * Sets the classInfoNameIndex.
208      * @param classInfoNameIndex The classInfoNameIndex to set
209      */

210     public void setClassInfoNameIndex(int classInfoNameIndex) {
211         this.classInfoNameIndex = classInfoNameIndex;
212     }
213
214     /**
215      * Sets the classIndex.
216      * @param classIndex The classIndex to set
217      */

218     public void setClassIndex(int classIndex) {
219         this.classIndex = classIndex;
220     }
221
222     /**
223      * Sets the nameAndTypeIndex.
224      * @param nameAndTypeIndex The nameAndTypeIndex to set
225      */

226     public void setNameAndTypeIndex(int nameAndTypeIndex) {
227         this.nameAndTypeIndex = nameAndTypeIndex;
228     }
229
230     /**
231      * Sets the stringIndex.
232      * @param stringIndex The stringIndex to set
233      */

234     public void setStringIndex(int stringIndex) {
235         this.stringIndex = stringIndex;
236     }
237
238     /**
239      * Sets the stringValue.
240      * @param stringValue The stringValue to set
241      */

242     public void setStringValue(char[] stringValue) {
243         this.stringValue = stringValue;
244     }
245
246     /**
247      * Sets the integerValue.
248      * @param integerValue The integerValue to set
249      */

250     public void setIntegerValue(int integerValue) {
251         this.integerValue = integerValue;
252     }
253
254     /**
255      * Sets the floatValue.
256      * @param floatValue The floatValue to set
257      */

258     public void setFloatValue(float floatValue) {
259         this.floatValue = floatValue;
260     }
261
262     /**
263      * Sets the doubleValue.
264      * @param doubleValue The doubleValue to set
265      */

266     public void setDoubleValue(double doubleValue) {
267         this.doubleValue = doubleValue;
268     }
269
270     /**
271      * Sets the longValue.
272      * @param longValue The longValue to set
273      */

274     public void setLongValue(long longValue) {
275         this.longValue = longValue;
276     }
277
278     /**
279      * Gets the nameAndTypeDescriptorIndex.
280      * @return Returns a int
281      */

282     public int getNameAndTypeDescriptorIndex() {
283         return nameAndTypeDescriptorIndex;
284     }
285
286     /**
287      * Sets the nameAndTypeDescriptorIndex.
288      * @param nameAndTypeDescriptorIndex The nameAndTypeDescriptorIndex to set
289      */

290     public void setNameAndTypeDescriptorIndex(int nameAndTypeDescriptorIndex) {
291         this.nameAndTypeDescriptorIndex = nameAndTypeDescriptorIndex;
292     }
293
294     /**
295      * Gets the nameAndTypeNameIndex.
296      * @return Returns a int
297      */

298     public int getNameAndTypeNameIndex() {
299         return nameAndTypeNameIndex;
300     }
301
302     /**
303      * Sets the nameAndTypeNameIndex.
304      * @param nameAndTypeNameIndex The nameAndTypeNameIndex to set
305      */

306     public void setNameAndTypeNameIndex(int nameAndTypeNameIndex) {
307         this.nameAndTypeNameIndex = nameAndTypeNameIndex;
308     }
309
310     /**
311      * Sets the className.
312      * @param className The className to set
313      */

314     public void setClassName(char[] className) {
315         this.className = className;
316     }
317
318     /**
319      * Sets the fieldName.
320      * @param fieldName The fieldName to set
321      */

322     public void setFieldName(char[] fieldName) {
323         this.fieldName = fieldName;
324     }
325
326     /**
327      * Sets the methodName.
328      * @param methodName The methodName to set
329      */

330     public void setMethodName(char[] methodName) {
331         this.methodName = methodName;
332     }
333
334     /**
335      * Sets the fieldDescriptor.
336      * @param fieldDescriptor The fieldDescriptor to set
337      */

338     public void setFieldDescriptor(char[] fieldDescriptor) {
339         this.fieldDescriptor = fieldDescriptor;
340     }
341
342     /**
343      * Sets the methodDescriptor.
344      * @param methodDescriptor The methodDescriptor to set
345      */

346     public void setMethodDescriptor(char[] methodDescriptor) {
347         this.methodDescriptor = methodDescriptor;
348     }
349
350     /**
351      * Sets the utf8Value.
352      * @param utf8Value The utf8Value to set
353      */

354     public void setUtf8Value(char[] utf8Value) {
355         this.utf8Value = utf8Value;
356     }
357
358     /**
359      * Sets the classInfoName.
360      * @param classInfoName The classInfoName to set
361      */

362     public void setClassInfoName(char[] classInfoName) {
363         this.classInfoName = classInfoName;
364     }
365
366     /**
367      * @see IConstantPoolEntry#getUtf8Length()
368      */

369     public int getUtf8Length() {
370         return this.utf8Length;
371     }
372
373     /**
374      * Sets the utf8Length.
375      * @param utf8Length The utf8Length to set
376      */

377     public void setUtf8Length(int utf8Length) {
378         this.utf8Length = utf8Length;
379     }
380
381     public void reset() {
382         this.kind = 0;
383         this.classInfoNameIndex = 0;
384         this.classIndex = 0;
385         this.nameAndTypeIndex = 0;
386         this.stringIndex = 0;
387         this.stringValue = null;
388         this.integerValue = 0;
389         this.floatValue = 0.0f;
390         this.doubleValue = 0.0;
391         this.longValue = 0L;
392         this.nameAndTypeDescriptorIndex = 0;
393         this.nameAndTypeNameIndex = 0;
394         this.className = null;
395         this.fieldName = null;
396         this.methodName = null;
397         this.fieldDescriptor = null;
398         this.methodDescriptor = null;
399         this.utf8Value = null;
400         this.utf8Length = 0;
401         this.classInfoName = null;
402     }
403 }
404
Popular Tags