KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > IDocumentElementRequestor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.compiler;
12
13 import org.eclipse.jdt.core.compiler.CategorizedProblem;
14
15 /**
16  * Part of the source element parser responsible for building the output.
17  * It gets notified of structural information as they are detected, relying
18  * on the requestor to assemble them together, based on the notifications it got.
19  *
20  * The structural investigation includes:
21  * - package statement
22  * - import statements
23  * - top-level types: package member, member types (member types of member types...)
24  * - fields
25  * - methods
26  *
27  * If reference information is requested, then all source constructs are
28  * investigated and type, field & method references are provided as well.
29  *
30  * Any (parsing) problem encountered is also provided.
31  *
32  * All positions are relative to the exact source fed to the parser.
33  *
34  * Elements which are complex are notified in two steps:
35  * - enter<Element> : once the element header has been identified
36  * - exit<Element> : once the element has been fully consumed
37  *
38  * other simpler elements (package, import) are read all at once:
39  * - accept<Element>
40  */

41  
42 public interface IDocumentElementRequestor {
43 /**
44  * @param declarationStart - a source position corresponding to the start of the package
45  * declaration
46  * @param declarationEnd - a source position corresponding to the end of the package
47  * declaration
48  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
49  * positions of the available JavaDoc comments. The array is a flattened
50  * structure: 2*n entries with consecutives start and end positions.
51  * If no JavaDoc is available, then null is answered instead of an empty array.
52  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
53  * The array is equals to null if there are no javadoc comments
54  * @param name - the name of the package
55  * @param nameStartPosition - a source position corresponding to the first character of the
56  * name
57  * @param onDemand - a boolean equals to true if the import is an import on demand
58  */

59 void acceptImport(
60     int declarationStart,
61     int declarationEnd,
62     int[] javaDocPositions,
63     char[] name,
64     int nameStartPosition,
65     boolean onDemand,
66     int modifiers);
67 /**
68  * @param declarationStart - a source position corresponding to the start of the package
69  * declaration
70  * @param declarationEnd - a source position corresponding to the end of the package
71  * declaration
72  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
73  * positions of the available JavaDoc comments. The array is a flattened
74  * structure: 2*n entries with consecutives start and end positions.
75  * If no JavaDoc is available, then null is answered instead of an empty array.
76  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
77  * The array is equals to null if there are no javadoc comments
78  * @param modifiers - the modifiers for this initializer
79  * @param modifiersStart - a source position corresponding to the start
80  * of the textual modifiers, is < 0 if there are no textual modifiers
81  * @param bodyStart - the position of the '{'
82  * @param bodyEnd - the position of the '}'
83  */

84 void acceptInitializer(
85     int declarationStart,
86     int declarationEnd,
87     int[] javaDocPositions,
88     int modifiers,
89     int modifiersStart,
90     int bodyStart,
91     int bodyEnd);
92 /*
93  * Table of line separator position. This table is passed once at the end
94  * of the parse action, so as to allow computation of normalized ranges.
95  *
96  * A line separator might corresponds to several characters in the source,
97  *
98  */

99 void acceptLineSeparatorPositions(int[] positions);
100 /**
101  * @param declarationStart - a source position corresponding to the start of the package
102  * declaration
103  * @param declarationEnd - a source position corresponding to the end of the package
104  * declaration
105  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
106  * positions of the available JavaDoc comments. The array is a flattened
107  * structure: 2*n entries with consecutives start and end positions.
108  * If no JavaDoc is available, then null is answered instead of an empty array.
109  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
110  * The array is equals to null if there are no javadoc comments
111  * @param name - the name of the package
112  * @param nameStartPosition - a source position corresponding to the first character of the
113  * name
114  */

115 void acceptPackage(
116     int declarationStart,
117     int declarationEnd,
118     int[] javaDocPositions,
119     char[] name,
120     int nameStartPosition);
121 /**
122  * @param problem - Used to report a problem while running the JDOM
123  */

124 void acceptProblem(CategorizedProblem problem);
125 /**
126  * @param declarationStart - a source position corresponding to the start
127  * of this class.
128  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
129  * positions of the available JavaDoc comments. The array is a flattened
130  * structure: 2*n entries with consecutives start and end positions.
131  * If no JavaDoc is available, then null is answered instead of an empty array.
132  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
133  * The array is equals to null if there are no javadoc comments
134  * @param modifiers - the modifiers for this class
135  * @param modifiersStart - a source position corresponding to the start
136  * of the textual modifiers, is < 0 if there are no textual modifiers
137  * @param classStart - a source position corresponding to the start
138  * of the keyword 'class'
139  * @param name - the name of the class
140  * @param nameStart - a source position corresponding to the start of the name
141  * @param nameEnd - a source position corresponding to the end of the name
142  * @param superclass - the name of the superclass
143  * @param superclassStart - a source position corresponding to the start
144  * of the superclass name
145  * @param superclassEnd - a source position corresponding to the end of the
146  * superclass name
147  * @param superinterfaces - the name of the superinterfaces
148  * @param superinterfaceStarts - an array of source positions corresponding
149  * to the start of their respective superinterface names
150  * @param superinterfaceEnds - an array of source positions corresponding
151  * to the end of their respective superinterface names
152  * @param bodyStart - a source position corresponding to the open bracket
153  * of the class body
154  */

155 void enterClass(
156     int declarationStart,
157     int[] javaDocPositions,
158     int modifiers,
159     int modifiersStart,
160     int classStart,
161     char[] name,
162     int nameStart,
163     int nameEnd,
164     char[] superclass,
165     int superclassStart,
166     int superclassEnd,
167     char[][] superinterfaces,
168     int[] superinterfaceStarts,
169     int[] superinterfaceEnds,
170     int bodyStart);
171 void enterCompilationUnit();
172 /**
173  * @param declarationStart - a source position corresponding to the first character
174  * of this constructor declaration
175  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
176  * positions of the available JavaDoc comments. The array is a flattened
177  * structure: 2*n entries with consecutives start and end positions.
178  * If no JavaDoc is available, then null is answered instead of an empty array.
179  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
180  * The array is equals to null if there are no javadoc comments
181  * @param modifiers - the modifiers for this constructor converted to a flag
182  * @param modifiersStart - a source position corresponding to the first character of the
183  * textual modifiers
184  * @param name - the name of this constructor
185  * @param nameStart - a source position corresponding to the first character of the name
186  * @param nameEnd - a source position corresponding to the last character of the name
187  * @param parameterTypes - a list of parameter type names
188  * @param parameterTypeStarts - a list of source positions corresponding to the
189  * first character of each parameter type name
190  * @param parameterTypeEnds - a list of source positions corresponding to the
191  * last character of each parameter type name
192  * @param parameterNames - a list of the names of the parameters
193  * @param parametersEnd - a source position corresponding to the last character of the
194  * parameter list
195  * @param exceptionTypes - a list of the exception types
196  * @param exceptionTypeStarts - a list of source positions corresponding to the first
197  * character of the respective exception types
198  * @param exceptionTypeEnds - a list of source positions corresponding to the last
199  * character of the respective exception types
200  * @param bodyStart - a source position corresponding to the start of this
201  * constructor's body
202  */

203 void enterConstructor(
204     int declarationStart,
205     int[] javaDocPositions,
206     int modifiers,
207     int modifiersStart,
208     char[] name,
209     int nameStart,
210     int nameEnd,
211     char[][] parameterTypes,
212     int [] parameterTypeStarts,
213     int [] parameterTypeEnds,
214     char[][] parameterNames,
215     int [] parameterNameStarts,
216     int [] parameterNameEnds,
217     int parametersEnd,
218     char[][] exceptionTypes,
219     int [] exceptionTypeStarts,
220     int [] exceptionTypeEnds,
221     int bodyStart);
222 /**
223  * @param declarationStart - a source position corresponding to the first character
224  * of this field
225  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
226  * positions of the available JavaDoc comments. The array is a flattened
227  * structure: 2*n entries with consecutives start and end positions.
228  * If no JavaDoc is available, then null is answered instead of an empty array.
229  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
230  * The array is equals to null if there are no javadoc comments
231  * @param modifiers - the modifiers for this field converted to a flag
232  * @param modifiersStart - a source position corresponding to the first character of the
233  * textual modifiers
234  * @param type - the name of the field type
235  * @param typeStart - a source position corresponding to the start of the fields type
236  * @param typeEnd - a source position corresponding to the end of the fields type
237  * @param typeDimensionCount - the array dimension indicated on the type (for example, 'int[] v')
238  * @param name - the name of this constructor
239  * @param nameStart - a source position corresponding to the first character of the name
240  * @param nameEnd - a source position corresponding to the last character of the name
241  * @param extendedTypeDimensionCount - the array dimension indicated on the variable,
242  * (for example, 'int v[]')
243  * @param extendedTypeDimensionEnd - a source position corresponding to the end of
244  * the extened type dimension. This position should be -1 in case there is no extended
245  * dimension for the type.
246  */

247 void enterField(
248     int declarationStart,
249     int[] javaDocPositions,
250     int modifiers,
251     int modifiersStart,
252     char[] type,
253     int typeStart,
254     int typeEnd,
255     int typeDimensionCount,
256     char[] name,
257     int nameStart,
258     int nameEnd,
259     int extendedTypeDimensionCount,
260     int extendedTypeDimensionEnd);
261 /**
262  * @param declarationStart - a source position corresponding to the start
263  * of this class.
264  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
265  * positions of the available JavaDoc comments. The array is a flattened
266  * structure: 2*n entries with consecutives start and end positions.
267  * If no JavaDoc is available, then null is answered instead of an empty array.
268  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
269  * The array is equals to null if there are no javadoc comments
270  * @param modifiers - the modifiers for this class
271  * @param modifiersStart - a source position corresponding to the start
272  * of the textual modifiers, is < 0 if there are no textual modifiers
273  * @param interfaceStart - a source position corresponding to the start
274  * of the keyword 'interface'
275  * @param name - the name of the class
276  * @param nameStart - a source position corresponding to the start of the name
277  * @param nameEnd - a source position corresponding to the end of the name
278  * @param superinterfaces - the name of the superinterfaces
279  * @param superinterfaceStarts - an array of source positions corresponding
280  * to the start of their respective superinterface names
281  * @param superinterfaceEnds - an array of source positions corresponding
282  * to the end of their respective superinterface names
283  * @param bodyStart - a source position corresponding to the open bracket
284  * of the class body
285  */

286 void enterInterface(
287     int declarationStart,
288     int[] javaDocPositions,
289     int modifiers,
290     int modifiersStart,
291     int interfaceStart,
292     char[] name,
293     int nameStart,
294     int nameEnd,
295     char[][] superinterfaces,
296     int[] superinterfaceStarts,
297     int[] superinterfaceEnds,
298     int bodyStart);
299 /**
300  * @param declarationStart - a source position corresponding to the first character
301  * of this constructor declaration
302  * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
303  * positions of the available JavaDoc comments. The array is a flattened
304  * structure: 2*n entries with consecutives start and end positions.
305  * If no JavaDoc is available, then null is answered instead of an empty array.
306  * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
307  * The array is equals to null if there are no javadoc comments
308  * @param modifiers - the modifiers for this constructor converted to a flag
309  * @param modifiersStart - a source position corresponding to the first character of the
310  * textual modifiers
311  * @param returnType - the name of the return type
312  * @param returnTypeStart - a source position corresponding to the first character
313  * of the return type
314  * @param returnTypeEnd - a source position corresponding to the last character
315  * of the return type
316  * @param returnTypeDimensionCount - the array dimension count as supplied on the
317  * return type (for example, 'public int[] foo() {}')
318  * @param name - the name of this constructor
319  * @param nameStart - a source position corresponding to the first character of the name
320  * @param nameEnd - a source position corresponding to the last character of the name
321  * @param parameterTypes - a list of parameter type names
322  * @param parameterTypeStarts - a list of source positions corresponding to the
323  * first character of each parameter type name
324  * @param parameterTypeEnds - a list of source positions corresponding to the
325  * last character of each parameter type name
326  * @param parameterNames - a list of the names of the parameters
327  * @param parametersEnd - a source position corresponding to the last character of the
328  * parameter list
329  * @param extendedReturnTypeDimensionCount - the array dimension count as supplied on the
330  * end of the parameter list (for example, 'public int foo()[] {}')
331  * @param extendedReturnTypeDimensionEnd - a source position corresponding to the last character
332  * of the extended return type dimension. This position should be -1 in case there is no extended
333  * dimension for the type.
334  * @param exceptionTypes - a list of the exception types
335  * @param exceptionTypeStarts - a list of source positions corresponding to the first
336  * character of the respective exception types
337  * @param exceptionTypeEnds - a list of source positions corresponding to the last
338  * character of the respective exception types
339  * @param bodyStart - a source position corresponding to the start of this
340  * method's body
341  */

342 void enterMethod(
343     int declarationStart,
344     int[] javaDocPositions,
345     int modifiers,
346     int modifiersStart,
347     char[] returnType,
348     int returnTypeStart,
349     int returnTypeEnd,
350     int returnTypeDimensionCount,
351     char[] name,
352     int nameStart,
353     int nameEnd,
354     char[][] parameterTypes,
355     int [] parameterTypeStarts,
356     int [] parameterTypeEnds,
357     char[][] parameterNames,
358     int [] parameterNameStarts,
359     int [] parameterNameEnds,
360     int parametersEnd,
361     int extendedReturnTypeDimensionCount,
362     int extendedReturnTypeDimensionEnd,
363     char[][] exceptionTypes,
364     int [] exceptionTypeStarts,
365     int [] exceptionTypeEnds,
366     int bodyStart);
367 /**
368  * @param bodyEnd - a source position corresponding to the closing bracket of the class
369  * @param declarationEnd - a source position corresponding to the end of the class
370  * declaration. This can include whitespace and comments following the closing bracket.
371  */

372 void exitClass(
373     int bodyEnd,
374     int declarationEnd);
375 /**
376  * @param declarationEnd - a source position corresponding to the end of the compilation unit
377  */

378 void exitCompilationUnit(
379     int declarationEnd);
380 /**
381  * @param bodyEnd - a source position corresponding to the closing bracket of the method
382  * @param declarationEnd - a source position corresponding to the end of the method
383  * declaration. This can include whitespace and comments following the closing bracket.
384  */

385 void exitConstructor(
386     int bodyEnd,
387     int declarationEnd);
388 /**
389  * @param bodyEnd - a source position corresponding to the end of the field.
390  * @param declarationEnd - a source position corresponding to the end of the field.
391  * This can include whitespace and comments following the semi-colon.
392  */

393 void exitField(
394     int bodyEnd,
395     int declarationEnd);
396 /**
397  * @param bodyEnd - a source position corresponding to the closing bracket of the interface
398  * @param declarationEnd - a source position corresponding to the end of the interface
399  * declaration. This can include whitespace and comments following the closing bracket.
400  */

401 void exitInterface(
402     int bodyEnd,
403     int declarationEnd);
404 /**
405  * @param bodyEnd - a source position corresponding to the closing bracket of the method
406  * @param declarationEnd - a source position corresponding to the end of the method
407  * declaration. This can include whitespace and comments following the closing bracket.
408  */

409 void exitMethod(
410     int bodyEnd,
411     int declarationEnd);
412 }
413
Popular Tags