KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > dom > ASTNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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
12 package org.eclipse.jdt.core.dom;
13
14 import java.util.AbstractList JavaDoc;
15 import java.util.ArrayList JavaDoc;
16 import java.util.Collections JavaDoc;
17 import java.util.HashMap JavaDoc;
18 import java.util.Iterator JavaDoc;
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 /**
23  * Abstract superclass of all Abstract Syntax Tree (AST) node types.
24  * <p>
25  * An AST node represents a Java source code construct, such
26  * as a name, type, expression, statement, or declaration.
27  * </p>
28  * <p>
29  * Each AST node belongs to a unique AST instance, called the owning AST.
30  * The children of an AST node always have the same owner as their parent node.
31  * If a node from one AST is to be added to a different AST, the subtree must
32  * be cloned first to ensure that the added nodes have the correct owning AST.
33  * </p>
34  * <p>
35  * When an AST node is part of an AST, it has a unique parent node.
36  * Clients can navigate upwards, from child to parent, as well as downwards,
37  * from parent to child. Newly created nodes are unparented. When an
38  * unparented node is set as a child of a node (using a
39  * <code>set<i>CHILD</i></code> method), its parent link is set automatically
40  * and the parent link of the former child is set to <code>null</code>.
41  * For nodes with properties that include a list of children (for example,
42  * <code>Block</code> whose <code>statements</code> property is a list
43  * of statements), adding or removing an element to/for the list property
44  * automatically updates the parent links. These lists support the
45  * <code>List.set</code> method; however, the constraint that the same
46  * node cannot appear more than once means that this method cannot be used
47  * to swap elements without first removing the node.
48  * </p>
49  * <p>
50  * ASTs must not contain cycles. All operations that could create a cycle
51  * detect this possibility and fail.
52  * </p>
53  * <p>
54  * ASTs do not contain "holes" (missing subtrees). If a node is required to
55  * have a certain property, a syntactically plausible initial value is
56  * always supplied.
57  * </p>
58  * <p>
59  * The hierarchy of AST node types has some convenient groupings marked
60  * by abstract superclasses:
61  * <ul>
62  * <li>expressions - <code>Expression</code></li>
63  * <li>names - <code>Name</code> (a sub-kind of expression)</li>
64  * <li>statements - <code>Statement</code></li>
65  * <li>types - <code>Type</code></li>
66  * <li>type body declarations - <code>BodyDeclaration</code></li>
67  * </ul>
68  * </p>
69  * <p>
70  * Abstract syntax trees may be hand constructed by clients, using the
71  * <code>new<i>TYPE</i></code> factory methods (see <code>AST</code>) to
72  * create new nodes, and the various <code>set<i>CHILD</i></code> methods
73  * to connect them together.
74  * </p>
75  * <p>
76  * The class {@link ASTParser} parses a string
77  * containing a Java source code and returns an abstract syntax tree
78  * for it. The resulting nodes carry source ranges relating the node back to
79  * the original source characters. The source range covers the construct
80  * as a whole.
81  * </p>
82  * <p>
83  * Each AST node carries bit flags, which may convey additional information about
84  * the node. For instance, the parser uses a flag to indicate a syntax error.
85  * Newly created nodes have no flags set.
86  * </p>
87  * <p>
88  * Each AST node is capable of carrying an open-ended collection of
89  * client-defined properties. Newly created nodes have none.
90  * <code>getProperty</code> and <code>setProperty</code> are used to access
91  * these properties.
92  * </p>
93  * <p>
94  * AST nodes are thread-safe for readers provided there are no active writers.
95  * If one thread is modifying an AST, including creating new nodes or cloning
96  * existing ones, it is <b>not</b> safe for another thread to read, visit,
97  * write, create, or clone <em>any</em> of the nodes on the same AST.
98  * When synchronization is required, consider using the common AST
99  * object that owns the node; that is, use
100  * <code>synchronize (node.getAST()) {...}</code>.
101  * </p>
102  * <p>
103  * ASTs also support the visitor pattern; see the class <code>ASTVisitor</code>
104  * for details.
105  * </p>
106  * <p>
107  * Compilation units created by <code>ASTParser</code> from a
108  * source document can be serialized after arbitrary modifications
109  * with minimal loss of original formatting. See
110  * {@link CompilationUnit#recordModifications()} for details.
111  * See also {@link org.eclipse.jdt.core.dom.rewrite.ASTRewrite} for
112  * an alternative way to describe and serialize changes to a
113  * read-only AST.
114  * </p>
115  * This class is not intended to be subclassed by clients.
116  *
117  * @see ASTParser
118  * @see ASTVisitor
119  * @since 2.0
120  */

121 public abstract class ASTNode {
122     /*
123      * INSTRUCTIONS FOR ADDING NEW CONCRETE AST NODE TYPES
124      *
125      * There are several things that need to be changed when a
126      * new concrete AST node type (call it "FooBar"):
127      *
128      * 1. Create the FooBar AST node type class.
129      * The most effective way to do this is to copy a similar
130      * existing concrete node class to get a template that
131      * includes all the framework methods that must be implemented.
132      *
133      * 2. Add node type constant ASTNode.FOO_BAR.
134      * Node constants are numbered consecutively. Add the
135      * constant after the existing ones.
136      *
137      * 3. Add entry to ASTNode.nodeClassForType(int).
138      *
139      * 4. Add AST.newFooBar() factory method.
140      *
141      * 5. Add ASTVisitor.visit(FooBar) and endVisit(FooBar) methods.
142      *
143      * 6. Add ASTMatcher.match(FooBar,Object) method.
144      *
145      * 7. Ensure that SimpleName.isDeclaration() covers FooBar
146      * nodes if required.
147      *
148      * 8. Add NaiveASTFlattener.visit(FooBar) method to illustrate
149      * how these nodes should be serialized.
150      *
151      * 9. Update the AST test suites.
152      *
153      * The next steps are to update AST.parse* to start generating
154      * the new type of nodes, and ASTRewrite to serialize them back out.
155      */

156     
157     /**
158      * Node type constant indicating a node of type
159      * <code>AnonymousClassDeclaration</code>.
160      * @see AnonymousClassDeclaration
161      */

162     public static final int ANONYMOUS_CLASS_DECLARATION = 1;
163
164     /**
165      * Node type constant indicating a node of type
166      * <code>ArrayAccess</code>.
167      * @see ArrayAccess
168      */

169     public static final int ARRAY_ACCESS = 2;
170
171     /**
172      * Node type constant indicating a node of type
173      * <code>ArrayCreation</code>.
174      * @see ArrayCreation
175      */

176     public static final int ARRAY_CREATION = 3;
177
178     /**
179      * Node type constant indicating a node of type
180      * <code>ArrayInitializer</code>.
181      * @see ArrayInitializer
182      */

183     public static final int ARRAY_INITIALIZER = 4;
184
185     /**
186      * Node type constant indicating a node of type
187      * <code>ArrayType</code>.
188      * @see ArrayType
189      */

190     public static final int ARRAY_TYPE = 5;
191
192     /**
193      * Node type constant indicating a node of type
194      * <code>AssertStatement</code>.
195      * @see AssertStatement
196      */

197     public static final int ASSERT_STATEMENT = 6;
198
199     /**
200      * Node type constant indicating a node of type
201      * <code>Assignment</code>.
202      * @see Assignment
203      */

204     public static final int ASSIGNMENT = 7;
205
206     /**
207      * Node type constant indicating a node of type
208      * <code>Block</code>.
209      * @see Block
210      */

211     public static final int BLOCK = 8;
212
213     /**
214      * Node type constant indicating a node of type
215      * <code>BooleanLiteral</code>.
216      * @see BooleanLiteral
217      */

218     public static final int BOOLEAN_LITERAL = 9;
219
220     /**
221      * Node type constant indicating a node of type
222      * <code>BreakStatement</code>.
223      * @see BreakStatement
224      */

225     public static final int BREAK_STATEMENT = 10;
226
227     /**
228      * Node type constant indicating a node of type
229      * <code>CastExpression</code>.
230      * @see CastExpression
231      */

232     public static final int CAST_EXPRESSION = 11;
233
234     /**
235      * Node type constant indicating a node of type
236      * <code>CatchClause</code>.
237      * @see CatchClause
238      */

239     public static final int CATCH_CLAUSE = 12;
240
241     /**
242      * Node type constant indicating a node of type
243      * <code>CharacterLiteral</code>.
244      * @see CharacterLiteral
245      */

246     public static final int CHARACTER_LITERAL = 13;
247
248     /**
249      * Node type constant indicating a node of type
250      * <code>ClassInstanceCreation</code>.
251      * @see ClassInstanceCreation
252      */

253     public static final int CLASS_INSTANCE_CREATION = 14;
254
255     /**
256      * Node type constant indicating a node of type
257      * <code>CompilationUnit</code>.
258      * @see CompilationUnit
259      */

260     public static final int COMPILATION_UNIT = 15;
261
262     /**
263      * Node type constant indicating a node of type
264      * <code>ConditionalExpression</code>.
265      * @see ConditionalExpression
266      */

267     public static final int CONDITIONAL_EXPRESSION = 16;
268
269     /**
270      * Node type constant indicating a node of type
271      * <code>ConstructorInvocation</code>.
272      * @see ConstructorInvocation
273      */

274     public static final int CONSTRUCTOR_INVOCATION = 17;
275
276     /**
277      * Node type constant indicating a node of type
278      * <code>ContinueStatement</code>.
279      * @see ContinueStatement
280      */

281     public static final int CONTINUE_STATEMENT = 18;
282
283     /**
284      * Node type constant indicating a node of type
285      * <code>DoStatement</code>.
286      * @see DoStatement
287      */

288     public static final int DO_STATEMENT = 19;
289
290     /**
291      * Node type constant indicating a node of type
292      * <code>EmptyStatement</code>.
293      * @see EmptyStatement
294      */

295     public static final int EMPTY_STATEMENT = 20;
296
297     /**
298      * Node type constant indicating a node of type
299      * <code>ExpressionStatement</code>.
300      * @see ExpressionStatement
301      */

302     public static final int EXPRESSION_STATEMENT = 21;
303
304     /**
305      * Node type constant indicating a node of type
306      * <code>FieldAccess</code>.
307      * @see FieldAccess
308      */

309     public static final int FIELD_ACCESS = 22;
310
311     /**
312      * Node type constant indicating a node of type
313      * <code>FieldDeclaration</code>.
314      * @see FieldDeclaration
315      */

316     public static final int FIELD_DECLARATION = 23;
317
318     /**
319      * Node type constant indicating a node of type
320      * <code>ForStatement</code>.
321      * @see ForStatement
322      */

323     public static final int FOR_STATEMENT = 24;
324
325     /**
326      * Node type constant indicating a node of type
327      * <code>IfStatement</code>.
328      * @see IfStatement
329      */

330     public static final int IF_STATEMENT = 25;
331
332     /**
333      * Node type constant indicating a node of type
334      * <code>ImportDeclaration</code>.
335      * @see ImportDeclaration
336      */

337     public static final int IMPORT_DECLARATION = 26;
338
339     /**
340      * Node type constant indicating a node of type
341      * <code>InfixExpression</code>.
342      * @see InfixExpression
343      */

344     public static final int INFIX_EXPRESSION = 27;
345
346     /**
347      * Node type constant indicating a node of type
348      * <code>Initializer</code>.
349      * @see Initializer
350      */

351     public static final int INITIALIZER = 28;
352
353     /**
354      * Node type constant indicating a node of type
355      * <code>Javadoc</code>.
356      * @see Javadoc
357      */

358     public static final int JAVADOC = 29;
359
360     /**
361      * Node type constant indicating a node of type
362      * <code>LabeledStatement</code>.
363      * @see LabeledStatement
364      */

365     public static final int LABELED_STATEMENT = 30;
366
367     /**
368      * Node type constant indicating a node of type
369      * <code>MethodDeclaration</code>.
370      * @see MethodDeclaration
371      */

372     public static final int METHOD_DECLARATION = 31;
373
374     /**
375      * Node type constant indicating a node of type
376      * <code>MethodInvocation</code>.
377      * @see MethodInvocation
378      */

379     public static final int METHOD_INVOCATION = 32;
380
381     /**
382      * Node type constant indicating a node of type
383      * <code>NullLiteral</code>.
384      * @see NullLiteral
385      */

386     public static final int NULL_LITERAL = 33;
387
388     /**
389      * Node type constant indicating a node of type
390      * <code>NumberLiteral</code>.
391      * @see NumberLiteral
392      */

393     public static final int NUMBER_LITERAL = 34;
394
395     /**
396      * Node type constant indicating a node of type
397      * <code>PackageDeclaration</code>.
398      * @see PackageDeclaration
399      */

400     public static final int PACKAGE_DECLARATION = 35;
401
402     /**
403      * Node type constant indicating a node of type
404      * <code>ParenthesizedExpression</code>.
405      * @see ParenthesizedExpression
406      */

407     public static final int PARENTHESIZED_EXPRESSION = 36;
408
409     /**
410      * Node type constant indicating a node of type
411      * <code>PostfixExpression</code>.
412      * @see PostfixExpression
413      */

414     public static final int POSTFIX_EXPRESSION = 37;
415
416     /**
417      * Node type constant indicating a node of type
418      * <code>PrefixExpression</code>.
419      * @see PrefixExpression
420      */

421     public static final int PREFIX_EXPRESSION = 38;
422
423     /**
424      * Node type constant indicating a node of type
425      * <code>PrimitiveType</code>.
426      * @see PrimitiveType
427      */

428     public static final int PRIMITIVE_TYPE = 39;
429
430     /**
431      * Node type constant indicating a node of type
432      * <code>QualifiedName</code>.
433      * @see QualifiedName
434      */

435     public static final int QUALIFIED_NAME = 40;
436
437     /**
438      * Node type constant indicating a node of type
439      * <code>ReturnStatement</code>.
440      * @see ReturnStatement
441      */

442     public static final int RETURN_STATEMENT = 41;
443
444     /**
445      * Node type constant indicating a node of type
446      * <code>SimpleName</code>.
447      * @see SimpleName
448      */

449     public static final int SIMPLE_NAME = 42;
450
451     /**
452      * Node type constant indicating a node of type
453      * <code>SimpleType</code>.
454      * @see SimpleType
455      */

456     public static final int SIMPLE_TYPE = 43;
457
458     /**
459      * Node type constant indicating a node of type
460      * <code>SingleVariableDeclaration</code>.
461      * @see SingleVariableDeclaration
462      */

463     public static final int SINGLE_VARIABLE_DECLARATION = 44;
464
465     /**
466      * Node type constant indicating a node of type
467      * <code>StringLiteral</code>.
468      * @see StringLiteral
469      */

470     public static final int STRING_LITERAL = 45;
471
472     /**
473      * Node type constant indicating a node of type
474      * <code>SuperConstructorInvocation</code>.
475      * @see SuperConstructorInvocation
476      */

477     public static final int SUPER_CONSTRUCTOR_INVOCATION = 46;
478
479     /**
480      * Node type constant indicating a node of type
481      * <code>SuperFieldAccess</code>.
482      * @see SuperFieldAccess
483      */

484     public static final int SUPER_FIELD_ACCESS = 47;
485
486     /**
487      * Node type constant indicating a node of type
488      * <code>SuperMethodInvocation</code>.
489      * @see SuperMethodInvocation
490      */

491     public static final int SUPER_METHOD_INVOCATION = 48;
492
493     /**
494      * Node type constant indicating a node of type
495      * <code>SwitchCase</code>.
496      * @see SwitchCase
497      */

498     public static final int SWITCH_CASE = 49;
499
500     /**
501      * Node type constant indicating a node of type
502      * <code>SwitchStatement</code>.
503      * @see SwitchStatement
504      */

505     public static final int SWITCH_STATEMENT = 50;
506
507     /**
508      * Node type constant indicating a node of type
509      * <code>SynchronizedStatement</code>.
510      * @see SynchronizedStatement
511      */

512     public static final int SYNCHRONIZED_STATEMENT = 51;
513
514     /**
515      * Node type constant indicating a node of type
516      * <code>ThisExpression</code>.
517      * @see ThisExpression
518      */

519     public static final int THIS_EXPRESSION = 52;
520
521     /**
522      * Node type constant indicating a node of type
523      * <code>ThrowStatement</code>.
524      * @see ThrowStatement
525      */

526     public static final int THROW_STATEMENT = 53;
527
528     /**
529      * Node type constant indicating a node of type
530      * <code>TryStatement</code>.
531      * @see TryStatement
532      */

533     public static final int TRY_STATEMENT = 54;
534
535     /**
536      * Node type constant indicating a node of type
537      * <code>TypeDeclaration</code>.
538      * @see TypeDeclaration
539      */

540     public static final int TYPE_DECLARATION = 55;
541
542     /**
543      * Node type constant indicating a node of type
544      * <code>TypeDeclarationStatement</code>.
545      * @see TypeDeclarationStatement
546      */

547     public static final int TYPE_DECLARATION_STATEMENT = 56;
548
549     /**
550      * Node type constant indicating a node of type
551      * <code>TypeLiteral</code>.
552      * @see TypeLiteral
553      */

554     public static final int TYPE_LITERAL = 57;
555
556     /**
557      * Node type constant indicating a node of type
558      * <code>VariableDeclarationExpression</code>.
559      * @see VariableDeclarationExpression
560      */

561     public static final int VARIABLE_DECLARATION_EXPRESSION = 58;
562
563     /**
564      * Node type constant indicating a node of type
565      * <code>VariableDeclarationFragment</code>.
566      * @see VariableDeclarationFragment
567      */

568     public static final int VARIABLE_DECLARATION_FRAGMENT = 59;
569
570     /**
571      * Node type constant indicating a node of type
572      * <code>VariableDeclarationStatement</code>.
573      * @see VariableDeclarationStatement
574      */

575     public static final int VARIABLE_DECLARATION_STATEMENT = 60;
576
577     /**
578      * Node type constant indicating a node of type
579      * <code>WhileStatement</code>.
580      * @see WhileStatement
581      */

582     public static final int WHILE_STATEMENT = 61;
583
584     /**
585      * Node type constant indicating a node of type
586      * <code>InstanceofExpression</code>.
587      * @see InstanceofExpression
588      */

589     public static final int INSTANCEOF_EXPRESSION = 62;
590
591     /**
592      * Node type constant indicating a node of type
593      * <code>LineComment</code>.
594      * @see LineComment
595      * @since 3.0
596      */

597     public static final int LINE_COMMENT = 63;
598
599     /**
600      * Node type constant indicating a node of type
601      * <code>BlockComment</code>.
602      * @see BlockComment
603      * @since 3.0
604      */

605     public static final int BLOCK_COMMENT = 64;
606
607     /**
608      * Node type constant indicating a node of type
609      * <code>TagElement</code>.
610      * @see TagElement
611      * @since 3.0
612      */

613     public static final int TAG_ELEMENT = 65;
614
615     /**
616      * Node type constant indicating a node of type
617      * <code>TextElement</code>.
618      * @see TextElement
619      * @since 3.0
620      */

621     public static final int TEXT_ELEMENT = 66;
622
623     /**
624      * Node type constant indicating a node of type
625      * <code>MemberRef</code>.
626      * @see MemberRef
627      * @since 3.0
628      */

629     public static final int MEMBER_REF = 67;
630
631     /**
632      * Node type constant indicating a node of type
633      * <code>MethodRef</code>.
634      * @see MethodRef
635      * @since 3.0
636      */

637     public static final int METHOD_REF = 68;
638
639     /**
640      * Node type constant indicating a node of type
641      * <code>MethodRefParameter</code>.
642      * @see MethodRefParameter
643      * @since 3.0
644      */

645     public static final int METHOD_REF_PARAMETER = 69;
646
647     /**
648      * Node type constant indicating a node of type
649      * <code>EnhancedForStatement</code>.
650      * @see EnhancedForStatement
651      * @since 3.1
652      */

653     public static final int ENHANCED_FOR_STATEMENT = 70;
654
655     /**
656      * Node type constant indicating a node of type
657      * <code>EnumDeclaration</code>.
658      * @see EnumDeclaration
659      * @since 3.1
660      */

661     public static final int ENUM_DECLARATION = 71;
662     
663     /**
664      * Node type constant indicating a node of type
665      * <code>EnumConstantDeclaration</code>.
666      * @see EnumConstantDeclaration
667      * @since 3.1
668      */

669     public static final int ENUM_CONSTANT_DECLARATION = 72;
670     
671     /**
672      * Node type constant indicating a node of type
673      * <code>TypeParameter</code>.
674      * @see TypeParameter
675      * @since 3.1
676      */

677     public static final int TYPE_PARAMETER = 73;
678
679     /**
680      * Node type constant indicating a node of type
681      * <code>ParameterizedType</code>.
682      * @see ParameterizedType
683      * @since 3.1
684      */

685     public static final int PARAMETERIZED_TYPE = 74;
686
687     /**
688      * Node type constant indicating a node of type
689      * <code>QualifiedType</code>.
690      * @see QualifiedType
691      * @since 3.1
692      */

693     public static final int QUALIFIED_TYPE = 75;
694     
695     /**
696      * Node type constant indicating a node of type
697      * <code>WildcardType</code>.
698      * @see WildcardType
699      * @since 3.1
700      */

701     public static final int WILDCARD_TYPE = 76;
702     
703     /**
704      * Node type constant indicating a node of type
705      * <code>NormalAnnotation</code>.
706      * @see NormalAnnotation
707      * @since 3.1
708      */

709     public static final int NORMAL_ANNOTATION = 77;
710     
711     /**
712      * Node type constant indicating a node of type
713      * <code>MarkerAnnotation</code>.
714      * @see MarkerAnnotation
715      * @since 3.1
716      */

717     public static final int MARKER_ANNOTATION = 78;
718     
719     /**
720      * Node type constant indicating a node of type
721      * <code>SingleMemberAnnotation</code>.
722      * @see SingleMemberAnnotation
723      * @since 3.1
724      */

725     public static final int SINGLE_MEMBER_ANNOTATION = 79;
726     
727     /**
728      * Node type constant indicating a node of type
729      * <code>MemberValuePair</code>.
730      * @see MemberValuePair
731      * @since 3.1
732      */

733     public static final int MEMBER_VALUE_PAIR = 80;
734     
735     /**
736      * Node type constant indicating a node of type
737      * <code>AnnotationTypeDeclaration</code>.
738      * @see AnnotationTypeDeclaration
739      * @since 3.1
740      */

741     public static final int ANNOTATION_TYPE_DECLARATION = 81;
742     
743     /**
744      * Node type constant indicating a node of type
745      * <code>AnnotationTypeMemberDeclaration</code>.
746      * @see AnnotationTypeMemberDeclaration
747      * @since 3.1
748      */

749     public static final int ANNOTATION_TYPE_MEMBER_DECLARATION = 82;
750     
751     /**
752      * Node type constant indicating a node of type
753      * <code>Modifier</code>.
754      * @see Modifier
755      * @since 3.1
756      */

757     public static final int MODIFIER = 83;
758     
759     /**
760      * Returns the node class for the corresponding node type.
761      *
762      * @param nodeType AST node type
763      * @return the corresponding <code>ASTNode</code> subclass
764      * @exception IllegalArgumentException if <code>nodeType</code> is
765      * not a legal AST node type
766      * @see #getNodeType()
767      * @since 3.0
768      */

769     public static Class JavaDoc nodeClassForType(int nodeType) {
770         switch (nodeType) {
771             case ANNOTATION_TYPE_DECLARATION :
772                 return AnnotationTypeDeclaration.class;
773             case ANNOTATION_TYPE_MEMBER_DECLARATION :
774                 return AnnotationTypeMemberDeclaration.class;
775             case ANONYMOUS_CLASS_DECLARATION :
776                 return AnonymousClassDeclaration.class;
777             case ARRAY_ACCESS :
778                 return ArrayAccess.class;
779             case ARRAY_CREATION :
780                 return ArrayCreation.class;
781             case ARRAY_INITIALIZER :
782                 return ArrayInitializer.class;
783             case ARRAY_TYPE :
784                 return ArrayType.class;
785             case ASSERT_STATEMENT :
786                 return AssertStatement.class;
787             case ASSIGNMENT :
788                 return Assignment.class;
789             case BLOCK :
790                 return Block.class;
791             case BLOCK_COMMENT :
792                 return BlockComment.class;
793             case BOOLEAN_LITERAL :
794                 return BooleanLiteral.class;
795             case BREAK_STATEMENT :
796                 return BreakStatement.class;
797             case CAST_EXPRESSION :
798                 return CastExpression.class;
799             case CATCH_CLAUSE :
800                 return CatchClause.class;
801             case CHARACTER_LITERAL :
802                 return CharacterLiteral.class;
803             case CLASS_INSTANCE_CREATION :
804                 return ClassInstanceCreation.class;
805             case COMPILATION_UNIT :
806                 return CompilationUnit.class;
807             case CONDITIONAL_EXPRESSION :
808                 return ConditionalExpression.class;
809             case CONSTRUCTOR_INVOCATION :
810                 return ConstructorInvocation.class;
811             case CONTINUE_STATEMENT :
812                 return ContinueStatement.class;
813             case DO_STATEMENT :
814                 return DoStatement.class;
815             case EMPTY_STATEMENT :
816                 return EmptyStatement.class;
817             case ENHANCED_FOR_STATEMENT :
818                 return EnhancedForStatement.class;
819             case ENUM_CONSTANT_DECLARATION :
820                 return EnumConstantDeclaration.class;
821             case ENUM_DECLARATION :
822                 return EnumDeclaration.class;
823             case EXPRESSION_STATEMENT :
824                 return ExpressionStatement.class;
825             case FIELD_ACCESS :
826                 return FieldAccess.class;
827             case FIELD_DECLARATION :
828                 return FieldDeclaration.class;
829             case FOR_STATEMENT :
830                 return ForStatement.class;
831             case IF_STATEMENT :
832                 return IfStatement.class;
833             case IMPORT_DECLARATION :
834                 return ImportDeclaration.class;
835             case INFIX_EXPRESSION :
836                 return InfixExpression.class;
837             case INITIALIZER :
838                 return Initializer.class;
839             case INSTANCEOF_EXPRESSION :
840                 return InstanceofExpression.class;
841             case JAVADOC :
842                 return Javadoc.class;
843             case LABELED_STATEMENT :
844                 return LabeledStatement.class;
845             case LINE_COMMENT :
846                 return LineComment.class;
847             case MARKER_ANNOTATION :
848                 return MarkerAnnotation.class;
849             case MEMBER_REF :
850                 return MemberRef.class;
851             case MEMBER_VALUE_PAIR :
852                 return MemberValuePair.class;
853             case METHOD_DECLARATION :
854                 return MethodDeclaration.class;
855             case METHOD_INVOCATION :
856                 return MethodInvocation.class;
857             case METHOD_REF :
858                 return MethodRef.class;
859             case METHOD_REF_PARAMETER :
860                 return MethodRefParameter.class;
861             case MODIFIER :
862                 return Modifier.class;
863             case NORMAL_ANNOTATION :
864                 return NormalAnnotation.class;
865             case NULL_LITERAL :
866                 return NullLiteral.class;
867             case NUMBER_LITERAL :
868                 return NumberLiteral.class;
869             case PACKAGE_DECLARATION :
870                 return PackageDeclaration.class;
871             case PARAMETERIZED_TYPE :
872                 return ParameterizedType.class;
873             case PARENTHESIZED_EXPRESSION :
874                 return ParenthesizedExpression.class;
875             case POSTFIX_EXPRESSION :
876                 return PostfixExpression.class;
877             case PREFIX_EXPRESSION :
878                 return PrefixExpression.class;
879             case PRIMITIVE_TYPE :
880                 return PrimitiveType.class;
881             case QUALIFIED_NAME :
882                 return QualifiedName.class;
883             case QUALIFIED_TYPE :
884                 return QualifiedType.class;
885             case RETURN_STATEMENT :
886                 return ReturnStatement.class;
887             case SIMPLE_NAME :
888                 return SimpleName.class;
889             case SIMPLE_TYPE :
890                 return SimpleType.class;
891             case SINGLE_MEMBER_ANNOTATION :
892                 return SingleMemberAnnotation.class;
893             case SINGLE_VARIABLE_DECLARATION :
894                 return SingleVariableDeclaration.class;
895             case STRING_LITERAL :
896                 return StringLiteral.class;
897             case SUPER_CONSTRUCTOR_INVOCATION :
898                 return SuperConstructorInvocation.class;
899             case SUPER_FIELD_ACCESS :
900                 return SuperFieldAccess.class;
901             case SUPER_METHOD_INVOCATION :
902                 return SuperMethodInvocation.class;
903             case SWITCH_CASE:
904                 return SwitchCase.class;
905             case SWITCH_STATEMENT :
906                 return SwitchStatement.class;
907             case SYNCHRONIZED_STATEMENT :
908                 return SynchronizedStatement.class;
909             case TAG_ELEMENT :
910                 return TagElement.class;
911             case TEXT_ELEMENT :
912                 return TextElement.class;
913             case THIS_EXPRESSION :
914                 return ThisExpression.class;
915             case THROW_STATEMENT :
916                 return ThrowStatement.class;
917             case TRY_STATEMENT :
918                 return TryStatement.class;
919             case TYPE_DECLARATION :
920                 return TypeDeclaration.class;
921             case TYPE_DECLARATION_STATEMENT :
922                 return TypeDeclarationStatement.class;
923             case TYPE_LITERAL :
924                 return TypeLiteral.class;
925             case TYPE_PARAMETER :
926                 return TypeParameter.class;
927             case VARIABLE_DECLARATION_EXPRESSION :
928                 return VariableDeclarationExpression.class;
929             case VARIABLE_DECLARATION_FRAGMENT :
930                 return VariableDeclarationFragment.class;
931             case VARIABLE_DECLARATI