Source code: org/eclipse/jdt/core/dom/ASTVisitor.java
1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11
12 package org.eclipse.jdt.core.dom;
13
14 /**
15 * A visitor for abstract syntax trees.
16 * <p>
17 * For each different concrete AST node type <it>T</it> there are
18 * a pair of methods:
19 * <ul>
20 * <li><code>public boolean visit(<it>T</it> node)</code> - Visits
21 * the given node to perform some arbitrary operation. If <code>true</code>
22 * is returned, the given node's child nodes will be visited next; however,
23 * if <code>false</code> is returned, the given node's child nodes will
24 * not be visited. The default implementation provided by this class does
25 * nothing and returns <code>true</code> (with the exception of
26 * {@link #visit(Javadoc) ASTVisitor.visit(Javadoc)}).
27 * Subclasses may reimplement this method as needed.</li>
28 * <li><code>public void endVisit(<it>T</it> node)</code> - Visits
29 * the given node to perform some arbitrary operation. When used in the
30 * conventional way, this method is called after all of the given node's
31 * children have been visited (or immediately, if <code>visit</code> returned
32 * <code>false</code>). The default implementation provided by this class does
33 * nothing. Subclasses may reimplement this method as needed.</li>
34 * </ul>
35 * </p>
36 * In addition, there are a pair of methods for visiting AST nodes in the
37 * abstract, regardless of node type:
38 * <ul>
39 * <li><code>public void preVisit(ASTNode node)</code> - Visits
40 * the given node to perform some arbitrary operation.
41 * This method is invoked prior to the appropriate type-specific
42 * <code>visit</code> method.
43 * The default implementation of this method does nothing.
44 * Subclasses may reimplement this method as needed.</li>
45 * <li><code>public void postVisit(ASTNode node)</code> - Visits
46 * the given node to perform some arbitrary operation.
47 * This method is invoked after the appropriate type-specific
48 * <code>endVisit</code> method.
49 * The default implementation of this method does nothing.
50 * Subclasses may reimplement this method as needed.</li>
51 * </ul>
52 * <p>
53 * For nodes with list-valued properties, the child nodes within the list
54 * are visited in order. For nodes with multiple properties, the child nodes
55 * are visited in the order that most closely corresponds to the lexical
56 * reading order of the source program. For instance, for a type declaration
57 * node, the child ordering is: name, superclass, superinterfaces, and
58 * body declarations.
59 * </p>
60 * <p>
61 * While it is possible to modify the tree in the visitor, care is required to
62 * ensure that the consequences are as expected and desirable.
63 * During the course of an ordinary visit starting at a given node, every node
64 * in the subtree is visited exactly twice, first with <code>visit</code> and
65 * then with <code>endVisit</code>. During a traversal of a stationary tree,
66 * each node is either behind (after <code>endVisit</code>), ahead (before
67 * <code>visit</code>), or in progress (between <code>visit</code> and
68 * the matching <code>endVisit</code>). Changes to the "behind" region of the
69 * tree are of no consequence to the visit in progress. Changes to the "ahead"
70 * region will be taken in stride. Changes to the "in progress" portion are
71 * the more interesting cases. With a node, the various properties are arranged
72 * in a linear list, with a cursor that separates the properties that have
73 * been visited from the ones that are still to be visited (the cursor
74 * is between the elements, rather than on an element). The cursor moves from
75 * the head to the tail of this list, advancing to the next position just
76 * <it>before</it> <code>visit</code> if called for that child. After the child
77 * subtree has been completely visited, the visit moves on the child
78 * immediately after the cursor. Removing a child while it is being visited
79 * does not alter the course of the visit. But any children added at positions
80 * after the cursor are considered in the "ahead" portion and will be visited.
81 * </p>
82 * <p>
83 * Cases to watch out for:
84 * <ul>
85 * <li>Moving a child node further down the list. This could result in the
86 * child subtree being visited multiple times; these visits are sequential.</li>
87 * <li>Moving a child node up into an ancestor. If the new home for
88 * the node is in the "ahead" portion, the subtree will be visited
89 * a second time; again, these visits are sequential.</li>
90 * <li>Moving a node down into a child. If the new home for
91 * the node is in the "ahead" portion, the subtree will be visited
92 * a second time; in this case, the visits will be nested. In some cases,
93 * this can lead to a stack overflow or out of memory condition.</li>
94 * </ul>
95 * </p>
96 *
97 * @see org.eclipse.jdt.core.dom.ASTNode#accept(ASTVisitor)
98 */
99 public abstract class ASTVisitor {
100
101 /**
102 * Indicates whether doc tags should be visited by default.
103 * @since 3.0
104 */
105 private boolean visitDocTags;
106
107 /**
108 * Creates a new AST visitor instance.
109 * <p>
110 * For backwards compatibility, the visitor does not visit tag
111 * elements below doc comments by default. Use
112 * {@link #ASTVisitor(boolean) ASTVisitor(true)}
113 * for an visitor that includes doc comments by default.
114 * </p>
115 */
116 public ASTVisitor() {
117 this(false);
118 }
119
120 /**
121 * Creates a new AST visitor instance.
122 *
123 * @param visitDocTags <code>true</code> if doc comment tags are
124 * to be visited by default, and <code>false</code> otherwise
125 * @see Javadoc#tags()
126 * @see #visit(Javadoc)
127 * @since 3.0
128 */
129 public ASTVisitor(boolean visitDocTags) {
130 this.visitDocTags = visitDocTags;
131 }
132
133 /**
134 * Visits the given AST node prior to the type-specific visit.
135 * (before <code>visit</code>).
136 * <p>
137 * The default implementation does nothing. Subclasses may reimplement.
138 * </p>
139 *
140 * @param node the node to visit
141 */
142 public void preVisit(ASTNode node) {
143 // default implementation: do nothing
144 }
145
146 /**
147 * Visits the given AST node following the type-specific visit
148 * (after <code>endVisit</code>).
149 * <p>
150 * The default implementation does nothing. Subclasses may reimplement.
151 * </p>
152 *
153 * @param node the node to visit
154 */
155 public void postVisit(ASTNode node) {
156 // default implementation: do nothing
157 }
158
159
160 /**
161 * Visits the given type-specific AST node.
162 * <p>
163 * The default implementation does nothing and return true.
164 * Subclasses may reimplement.
165 * </p>
166 *
167 * @param node the node to visit
168 * @return <code>true</code> if the children of this node should be
169 * visited, and <code>false</code> if the children of this node should
170 * be skipped
171 * @since 3.0
172 */
173 public boolean visit(AnnotationTypeDeclaration node) {
174 return true;
175 }
176
177
178 /**
179 * Visits the given type-specific AST node.
180 * <p>
181 * The default implementation does nothing and return true.
182 * Subclasses may reimplement.
183 * </p>
184 *
185 * @param node the node to visit
186 * @return <code>true</code> if the children of this node should be
187 * visited, and <code>false</code> if the children of this node should
188 * be skipped
189 * @since 3.0
190 */
191 public boolean visit(AnnotationTypeMemberDeclaration node) {
192 return true;
193 }
194
195 /**
196 * Visits the given type-specific AST node.
197 * <p>
198 * The default implementation does nothing and return true.
199 * Subclasses may reimplement.
200 * </p>
201 *
202 * @param node the node to visit
203 * @return <code>true</code> if the children of this node should be
204 * visited, and <code>false</code> if the children of this node should
205 * be skipped
206 */
207 public boolean visit(AnonymousClassDeclaration node) {
208 return true;
209 }
210
211 /**
212 * Visits the given type-specific AST node.
213 * <p>
214 * The default implementation does nothing and return true.
215 * Subclasses may reimplement.
216 * </p>
217 *
218 * @param node the node to visit
219 * @return <code>true</code> if the children of this node should be
220 * visited, and <code>false</code> if the children of this node should
221 * be skipped
222 */
223 public boolean visit(ArrayAccess node) {
224 return true;
225 }
226
227 /**
228 * Visits the given type-specific AST node.
229 * <p>
230 * The default implementation does nothing and return true.
231 * Subclasses may reimplement.
232 * </p>
233 *
234 * @param node the node to visit
235 * @return <code>true</code> if the children of this node should be
236 * visited, and <code>false</code> if the children of this node should
237 * be skipped
238 */
239 public boolean visit(ArrayCreation node) {
240 return true;
241 }
242
243 /**
244 * Visits the given type-specific AST node.
245 * <p>
246 * The default implementation does nothing and return true.
247 * Subclasses may reimplement.
248 * </p>
249 *
250 * @param node the node to visit
251 * @return <code>true</code> if the children of this node should be
252 * visited, and <code>false</code> if the children of this node should
253 * be skipped
254 */
255 public boolean visit(ArrayInitializer node) {
256 return true;
257 }
258
259 /**
260 * Visits the given type-specific AST node.
261 * <p>
262 * The default implementation does nothing and return true.
263 * Subclasses may reimplement.
264 * </p>
265 *
266 * @param node the node to visit
267 * @return <code>true</code> if the children of this node should be
268 * visited, and <code>false</code> if the children of this node should
269 * be skipped
270 */
271 public boolean visit(ArrayType node) {
272 return true;
273 }
274
275 /**
276 * Visits the given type-specific AST node.
277 * <p>
278 * The default implementation does nothing and return true.
279 * Subclasses may reimplement.
280 * </p>
281 *
282 * @param node the node to visit
283 * @return <code>true</code> if the children of this node should be
284 * visited, and <code>false</code> if the children of this node should
285 * be skipped
286 */
287 public boolean visit(AssertStatement node) {
288 return true;
289 }
290
291 /**
292 * Visits the given type-specific AST node.
293 * <p>
294 * The default implementation does nothing and return true.
295 * Subclasses may reimplement.
296 * </p>
297 *
298 * @param node the node to visit
299 * @return <code>true</code> if the children of this node should be
300 * visited, and <code>false</code> if the children of this node should
301 * be skipped
302 */
303 public boolean visit(Assignment node) {
304 return true;
305 }
306
307 /**
308 * Visits the given type-specific AST node.
309 * <p>
310 * The default implementation does nothing and return true.
311 * Subclasses may reimplement.
312 * </p>
313 *
314 * @param node the node to visit
315 * @return <code>true</code> if the children of this node should be
316 * visited, and <code>false</code> if the children of this node should
317 * be skipped
318 */
319 public boolean visit(Block node) {
320 return true;
321 }
322
323
324 /**
325 * Visits the given type-specific AST node.
326 * <p>
327 * The default implementation does nothing and return true.
328 * Subclasses may reimplement.
329 * </p>
330 *
331 * @param node the node to visit
332 * @return <code>true</code> if the children of this node should be
333 * visited, and <code>false</code> if the children of this node should
334 * be skipped
335 * @since 3.0
336 */
337 public boolean visit(BlockComment node) {
338 return true;
339 }
340
341 /**
342 * Visits the given type-specific AST node.
343 * <p>
344 * The default implementation does nothing and return true.
345 * Subclasses may reimplement.
346 * </p>
347 *
348 * @param node the node to visit
349 * @return <code>true</code> if the children of this node should be
350 * visited, and <code>false</code> if the children of this node should
351 * be skipped
352 */
353 public boolean visit(BooleanLiteral node) {
354 return true;
355 }
356
357 /**
358 * Visits the given type-specific AST node.
359 * <p>
360 * The default implementation does nothing and return true.
361 * Subclasses may reimplement.
362 * </p>
363 *
364 * @param node the node to visit
365 * @return <code>true</code> if the children of this node should be
366 * visited, and <code>false</code> if the children of this node should
367 * be skipped
368 */
369 public boolean visit(BreakStatement node) {
370 return true;
371 }
372
373 /**
374 * Visits the given type-specific AST node.
375 * <p>
376 * The default implementation does nothing and return true.
377 * Subclasses may reimplement.
378 * </p>
379 *
380 * @param node the node to visit
381 * @return <code>true</code> if the children of this node should be
382 * visited, and <code>false</code> if the children of this node should
383 * be skipped
384 */
385 public boolean visit(CastExpression node) {
386 return true;
387 }
388
389 /**
390 * Visits the given type-specific AST node.
391 * <p>
392 * The default implementation does nothing and return true.
393 * Subclasses may reimplement.
394 * </p>
395 *
396 * @param node the node to visit
397 * @return <code>true</code> if the children of this node should be
398 * visited, and <code>false</code> if the children of this node should
399 * be skipped
400 */
401 public boolean visit(CatchClause node) {
402 return true;
403 }
404
405 /**
406 * Visits the given type-specific AST node.
407 * <p>
408 * The default implementation does nothing and return true.
409 * Subclasses may reimplement.
410 * </p>
411 *
412 * @param node the node to visit
413 * @return <code>true</code> if the children of this node should be
414 * visited, and <code>false</code> if the children of this node should
415 * be skipped
416 */
417 public boolean visit(CharacterLiteral node) {
418 return true;
419 }
420
421 /**
422 * Visits the given type-specific AST node.
423 * <p>
424 * The default implementation does nothing and return true.
425 * Subclasses may reimplement.
426 * </p>
427 *
428 * @param node the node to visit
429 * @return <code>true</code> if the children of this node should be
430 * visited, and <code>false</code> if the children of this node should
431 * be skipped
432 */
433 public boolean visit(ClassInstanceCreation node) {
434 return true;
435 }
436
437 /**
438 * Visits the given type-specific AST node.
439 * <p>
440 * The default implementation does nothing and return true.
441 * Subclasses may reimplement.
442 * </p>
443 *
444 * @param node the node to visit
445 * @return <code>true</code> if the children of this node should be
446 * visited, and <code>false</code> if the children of this node should
447 * be skipped
448 */
449 public boolean visit(CompilationUnit node) {
450 return true;
451 }
452
453 /**
454 * Visits the given type-specific AST node.
455 * <p>
456 * The default implementation does nothing and return true.
457 * Subclasses may reimplement.
458 * </p>
459 *
460 * @param node the node to visit
461 * @return <code>true</code> if the children of this node should be
462 * visited, and <code>false</code> if the children of this node should
463 * be skipped
464 */
465 public boolean visit(ConditionalExpression node) {
466 return true;
467 }
468
469 /**
470 * Visits the given type-specific AST node.
471 * <p>
472 * The default implementation does nothing and return true.
473 * Subclasses may reimplement.
474 * </p>
475 *
476 * @param node the node to visit
477 * @return <code>true</code> if the children of this node should be
478 * visited, and <code>false</code> if the children of this node should
479 * be skipped
480 */
481 public boolean visit(ConstructorInvocation node) {
482 return true;
483 }
484
485 /**
486 * Visits the given type-specific AST node.
487 * <p>
488 * The default implementation does nothing and return true.
489 * Subclasses may reimplement.
490 * </p>
491 *
492 * @param node the node to visit
493 * @return <code>true</code> if the children of this node should be
494 * visited, and <code>false</code> if the children of this node should
495 * be skipped
496 */
497 public boolean visit(ContinueStatement node) {
498 return true;
499 }
500
501 /**
502 * Visits the given type-specific AST node.
503 * <p>
504 * The default implementation does nothing and return true.
505 * Subclasses may reimplement.
506 * </p>
507 *
508 * @param node the node to visit
509 * @return <code>true</code> if the children of this node should be
510 * visited, and <code>false</code> if the children of this node should
511 * be skipped
512 */
513 public boolean visit(DoStatement node) {
514 return true;
515 }
516
517 /**
518 * Visits the given type-specific AST node.
519 * <p>
520 * The default implementation does nothing and return true.
521 * Subclasses may reimplement.
522 * </p>
523 *
524 * @param node the node to visit
525 * @return <code>true</code> if the children of this node should be
526 * visited, and <code>false</code> if the children of this node should
527 * be skipped
528 */
529 public boolean visit(EmptyStatement node) {
530 return true;
531 }
532
533 /**
534 * Visits the given type-specific AST node.
535 * <p>
536 * The default implementation does nothing and return true.
537 * Subclasses may reimplement.
538 * </p>
539 *
540 * @param node the node to visit
541 * @return <code>true</code> if the children of this node should be
542 * visited, and <code>false</code> if the children of this node should
543 * be skipped
544 * @since 3.0
545 */
546 public boolean visit(EnhancedForStatement node) {
547 return true;
548 }
549
550 /**
551 * Visits the given type-specific AST node.
552 * <p>
553 * The default implementation does nothing and return true.
554 * Subclasses may reimplement.
555 * </p>
556 *
557 * @param node the node to visit
558 * @return <code>true</code> if the children of this node should be
559 * visited, and <code>false</code> if the children of this node should
560 * be skipped
561 * @since 3.0
562 */
563 public boolean visit(EnumConstantDeclaration node) {
564 return true;
565 }
566
567 /**
568 * Visits the given type-specific AST node.
569 * <p>
570 * The default implementation does nothing and return true.
571 * Subclasses may reimplement.
572 * </p>
573 *
574 * @param node the node to visit
575 * @return <code>true</code> if the children of this node should be
576 * visited, and <code>false</code> if the children of this node should
577 * be skipped
578 * @since 3.0
579 */
580 public boolean visit(EnumDeclaration node) {
581 return true;
582 }
583
584 /**
585 * Visits the given type-specific AST node.
586 * <p>
587 * The default implementation does nothing and return true.
588 * Subclasses may reimplement.
589 * </p>
590 *
591 * @param node the node to visit
592 * @return <code>true</code> if the children of this node should be
593 * visited, and <code>false</code> if the children of this node should
594 * be skipped
595 */
596 public boolean visit(ExpressionStatement node) {
597 return true;
598 }
599
600 /**
601 * Visits the given type-specific AST node.
602 * <p>
603 * The default implementation does nothing and return true.
604 * Subclasses may reimplement.
605 * </p>
606 *
607 * @param node the node to visit
608 * @return <code>true</code> if the children of this node should be
609 * visited, and <code>false</code> if the children of this node should
610 * be skipped
611 */
612 public boolean visit(FieldAccess node) {
613 return true;
614 }
615
616 /**
617 * Visits the given type-specific AST node.
618 * <p>
619 * The default implementation does nothing and return true.
620 * Subclasses may reimplement.
621 * </p>
622 *
623 * @param node the node to visit
624 * @return <code>true</code> if the children of this node should be
625 * visited, and <code>false</code> if the children of this node should
626 * be skipped
627 */
628 public boolean visit(FieldDeclaration node) {
629 return true;
630 }
631
632 /**
633 * Visits the given type-specific AST node.
634 * <p>
635 * The default implementation does nothing and return true.
636 * Subclasses may reimplement.
637 * </p>
638 *
639 * @param node the node to visit
640 * @return <code>true</code> if the children of this node should be
641 * visited, and <code>false</code> if the children of this node should
642 * be skipped
643 */
644 public boolean visit(ForStatement node) {
645 return true;
646 }
647
648 /**
649 * Visits the given type-specific AST node.
650 * <p>
651 * The default implementation does nothing and return true.
652 * Subclasses may reimplement.
653 * </p>
654 *
655 * @param node the node to visit
656 * @return <code>true</code> if the children of this node should be
657 * visited, and <code>false</code> if the children of this node should
658 * be skipped
659 */
660 public boolean visit(IfStatement node) {
661 return true;
662 }
663
664 /**
665 * Visits the given type-specific AST node.
666 * <p>
667 * The default implementation does nothing and return true.
668 * Subclasses may reimplement.
669 * </p>
670 *
671 * @param node the node to visit
672 * @return <code>true</code> if the children of this node should be
673 * visited, and <code>false</code> if the children of this node should
674 * be skipped
675 */
676 public boolean visit(ImportDeclaration node) {
677 return true;
678 }
679
680 /**
681 * Visits the given type-specific AST node.
682 * <p>
683 * The default implementation does nothing and return true.
684 * Subclasses may reimplement.
685 * </p>
686 *
687 * @param node the node to visit
688 * @return <code>true</code> if the children of this node should be
689 * visited, and <code>false</code> if the children of this node should
690 * be skipped
691 */
692 public boolean visit(InfixExpression node) {
693 return true;
694 }
695
696 /**
697 * Visits the given type-specific AST node.
698 * <p>
699 * The default implementation does nothing and return true.
700 * Subclasses may reimplement.
701 * </p>
702 *
703 * @param node the node to visit
704 * @return <code>true</code> if the children of this node should be
705 * visited, and <code>false</code> if the children of this node should
706 * be skipped
707 */
708 public boolean visit(InstanceofExpression node) {
709 return true;
710 }
711
712 /**
713 * Visits the given type-specific AST node.
714 * <p>
715 * The default implementation does nothing and return true.
716 * Subclasses may reimplement.
717 * </p>
718 *
719 * @param node the node to visit
720 * @return <code>true</code> if the children of this node should be
721 * visited, and <code>false</code> if the children of this node should
722 * be skipped
723 */
724 public boolean visit(Initializer node) {
725 return true;
726 }
727
728 /**
729 * Visits the given AST node.
730 * <p>
731 * Unlike other node types, the boolean returned by the default
732 * implementation is controlled by a constructor-supplied
733 * parameter {@link #ASTVisitor(boolean) ASTVisitor(boolean)}
734 * which is <code>false</code> by default.
735 * Subclasses may reimplement.
736 * </p>
737 *
738 * @param node the node to visit
739 * @return <code>true</code> if the children of this node should be
740 * visited, and <code>false</code> if the children of this node should
741 * be skipped
742 * @see #ASTVisitor()
743 * @see #ASTVisitor(boolean)
744 */
745 public boolean visit(Javadoc node) {
746 // visit tag elements inside doc comments only if requested
747 return this.visitDocTags;
748 }
749
750 /**
751 * Visits the given type-specific AST node.
752 * <p>
753 * The default implementation does nothing and return true.
754 * Subclasses may reimplement.
755 * </p>
756 *
757 * @param node the node to visit
758 * @return <code>true</code> if the children of this node should be
759 * visited, and <code>false</code> if the children of this node should
760 * be skipped
761 */
762 public boolean visit(LabeledStatement node) {
763 return true;
764 }
765
766
767 /**
768 * Visits the given type-specific AST node.
769 * <p>
770 * The default implementation does nothing and return true.
771 * Subclasses may reimplement.
772 * </p>
773 *
774 * @param node the node to visit
775 * @return <code>true</code> if the children of this node should be
776 * visited, and <code>false</code> if the children of this node should
777 * be skipped
778 * @since 3.0
779 */
780 public boolean visit(LineComment node) {
781 return true;
782 }
783
784
785 /**
786 * Visits the given type-specific AST node.
787 * <p>
788 * The default implementation does nothing and return true.
789 * Subclasses may reimplement.
790 * </p>
791 *
792 * @param node the node to visit
793 * @return <code>true</code> if the children of this node should be
794 * visited, and <code>false</code> if the children of this node should
795 * be skipped
796 * @since 3.0
797 */
798 public boolean visit(MarkerAnnotation node) {
799 return true;
800 }
801
802
803 /**
804 * Visits the given type-specific AST node.
805 * <p>
806 * The default implementation does nothing and return true.
807 * Subclasses may reimplement.
808 * </p>
809 *
810 * @param node the node to visit
811 * @return <code>true</code> if the children of this node should be
812 * visited, and <code>false</code> if the children of this node should
813 * be skipped
814 * @since 3.0
815 */
816 public boolean visit(MemberRef node) {
817 return true;
818 }
819
820
821 /**
822 * Visits the given type-specific AST node.
823 * <p>
824 * The default implementation does nothing and return true.
825 * Subclasses may reimplement.
826 * </p>
827 *
828 * @param node the node to visit
829 * @return <code>true</code> if the children of this node should be
830 * visited, and <code>false</code> if the children of this node should
831 * be skipped
832 * @since 3.0
833 */
834 public boolean visit(MemberValuePair node) {
835 return true;
836 }
837
838
839 /**
840 * Visits the given type-specific AST node.
841 * <p>
842 * The default implementation does nothing and return true.
843 * Subclasses may reimplement.
844 * </p>
845 *
846 * @param node the node to visit
847 * @return <code>true</code> if the children of this node should be
848 * visited, and <code>false</code> if the children of this node should
849 * be skipped
850 * @since 3.0
851 */
852 public boolean visit(MethodRef node) {
853 return true;
854 }
855
856
857 /**
858 * Visits the given type-specific AST node.
859 * <p>
860 * The default implementation does nothing and return true.
861 * Subclasses may reimplement.
862 * </p>
863 *
864 * @param node the node to visit
865 * @return <code>true</code> if the children of this node should be
866 * visited, and <code>false</code> if the children of this node should
867 * be skipped
868 * @since 3.0
869 */
870 public boolean visit(MethodRefParameter node) {
871 return true;
872 }
873
874
875 /**
876 * Visits the given type-specific AST node.
877 * <p>
878 * The default implementation does nothing and return true.
879 * Subclasses may reimplement.
880 * </p>
881 *
882 * @param node the node to visit
883 * @return <code>true</code> if the children of this node should be
884 * visited, and <code>false</code> if the children of this node should
885 * be skipped
886 */
887 public boolean visit(MethodDeclaration node) {
888 return true;
889 }
890
891 /**
892 * Visits the given type-specific AST node.
893 * <p>
894 * The default implementation does nothing and return true.
895 * Subclasses may reimplement.
896 * </p>
897 *
898 * @param node the node to visit
899 * @return <code>true</code> if the children of this node should be
900 * visited, and <code>false</code> if the children of this node should
901 * be skipped
902 */
903 public boolean visit(MethodInvocation node) {
904 return true;
905 }
906
907
908 /**
909 * Visits the given type-specific AST node.
910 * <p>
911 * The default implementation does nothing and return true.
912 * Subclasses may reimplement.
913 * </p>
914 *
915 * @param node the node to visit
916 * @return <code>true</code> if the children of this node should be
917 * visited, and <code>false</code> if the children of this node should
918 * be skipped
919 * @since 3.0
920 */
921 public boolean visit(Modifier node) {
922 return true;
923 }
924
925
926 /**
927 * Visits the given type-specific AST node.
928 * <p>
929 * The default implementation does nothing and return true.
930 * Subclasses may reimplement.
931 * </p>
932 *
933 * @param node the node to visit
934 * @return <code>true</code> if the children of this node should be
935 * visited, and <code>false</code> if the children of this node should
936 * be skipped
937 * @since 3.0
938 */
939 public boolean visit(NormalAnnotation node) {
940 return true;
941 }
942
943 /**
944 * Visits the given type-specific AST node.
945 * <p>
946 * The default implementation does nothing and return true.
947 * Subclasses may reimplement.
948 * </p>
949 *
950 * @param node the node to visit
951 * @return <code>true</code> if the children of this node should be
952 * visited, and <code>false</code> if the children of this node should
953 * be skipped
954 */
955 public boolean visit(NullLiteral node) {
956 return true;
957 }
958
959 /**
960 * Visits the given type-specific AST node.
961 * <p>
962 * The default implementation does nothing and return true.
963 * Subclasses may reimplement.
964 * </p>
965 *
966 * @param node the node to visit
967 * @return <code>true</code> if the children of this node should be
968 * visited, and <code>false</code> if the children of this node should
969 * be skipped
970 */
971 public boolean visit(NumberLiteral node) {
972 return true;
973 }
974
975 /**
976 * Visits the given type-specific AST node.
977 * <p>
978 * The default implementation does nothing and return true.
979 * Subclasses may reimplement.
980 * </p>
981 *
982 * @param node the node to visit
983 * @return <code>true</code> if the children of this node should be
984 * visited, and <code>false</code> if the children of this node should
985 * be skipped
986 */
987 public boolean visit(PackageDeclaration node) {
988 return true;
989 }
990
991
992 /**
993 * Visits the given type-specific AST node.
994 * <p>
995 * The default implementation does nothing and return true.
996 * Subclasses may reimplement.
997 * </p>
998 *
999 * @param node the node to visit
1000 * @return <code>true</code> if the children of this node should be
1001 * visited, and <code>false</code> if the children of this node should
1002 * be skipped
1003 * @since 3.0
1004 */
1005 public boolean visit(ParameterizedType node) {
1006 return true;
1007 }
1008
1009 /**
1010 * Visits the given type-specific AST node.
1011 * <p>
1012 * The default implementation does nothing and return true.
1013 * Subclasses may reimplement.
1014 * </p>
1015 *
1016 * @param node the node to visit
1017 * @return <code>true</code> if the children of this node should be
1018 * visited, and <code>false</code> if the children of this node should
1019 * be skipped
1020 */
1021 public boolean visit(ParenthesizedExpression node) {
1022 return true;
1023 }
1024
1025 /**
1026 * Visits the given type-specific AST node.
1027 * <p>
1028 * The default implementation does nothing and return true.
1029 * Subclasses may reimplement.
1030 * </p>
1031 *
1032 * @param node the node to visit
1033 * @return <code>true</code> if the children of this node should be
1034 * visited, and <code>false</code> if the children of this node should
1035 * be skipped
1036 */
1037 public boolean visit(PostfixExpression node) {
1038 return true;
1039 }
1040
1041 /**
1042 * Visits the given type-specific AST node.
1043 * <p>
1044 * The default implementation does nothing and return true.
1045 * Subclasses may reimplement.
1046 * </p>
1047 *
1048 * @param node the node to visit
1049 * @return <code>true</code> if the children of this node should be
1050 * visited, and <code>false</code> if the children of this node should
1051 * be skipped
1052 */
1053 public boolean visit(PrefixExpression node) {
1054 return true;
1055 }
1056
1057 /**
1058 * Visits the given type-specific AST node.
1059 * <p>
1060 * The default implementation does nothing and return true.
1061 * Subclasses may reimplement.
1062 * </p>
1063 *
1064 * @param node the node to visit
1065 * @return <code>true</code> if the children of this node should be
1066 * visited, and <code>false</code> if the children of this node should
1067 * be skipped
1068 */
1069 public boolean visit(PrimitiveType node) {
1070 return true;
1071 }
1072
1073 /**
1074 * Visits the given type-specific AST node.
1075 * <p>
1076 * The default implementation does nothing and return true.
1077 * Subclasses may reimplement.
1078 * </p>
1079 *
1080 * @param node the node to visit
1081 * @return <code>true</code> if the children of this node should be
1082 * visited, and <code>false</code> if the children of this node should
1083 * be skipped
1084 */
1085 public boolean visit(QualifiedName node) {
1086 return true;
1087 }
1088
1089 /**
1090 * Visits the given type-specific AST node.
1091 * <p>
1092 * The default implementation does nothing and return true.
1093 * Subclasses may reimplement.
1094 * </p>
1095 *
1096 * @param node the node to visit
1097 * @return <code>true</code> if the children of this node should be
1098 * visited, and <code>false</code> if the children of this node should
1099 * be skipped
1100 * @since 3.0
1101 */
1102 public boolean visit(QualifiedType node) {
1103 return true;
1104 }
1105
1106 /**
1107 * Visits the given type-specific AST node.
1108 * <p>
1109 * The default implementation does nothing and return true.
1110 * Subclasses may reimplement.
1111 * </p>
1112 *
1113 * @param node the node to visit
1114 * @return <code>true</code> if the children of this node should be
1115 * visited, and <code>false</code> if the children of this node should
1116 * be skipped
1117 */
1118 public boolean visit(ReturnStatement node) {
1119 return true;
1120 }
1121
1122 /**
1123 * Visits the given type-specific AST node.
1124 * <p>
1125 * The default implementation does nothing and return true.
1126 * Subclasses may reimplement.
1127 * </p>
1128 *
1129 * @param node the node to visit
1130 * @return <code>true</code> if the children of this node should be
1131 * visited, and <code>false</code> if the children of this node should
1132 * be skipped
1133 */
1134 public boolean visit(SimpleName node) {
1135 return true;
1136 }
1137
1138 /**
1139 * Visits the given type-specific AST node.
1140 * <p>
1141 * The default implementation does nothing and return true.
1142 * Subclasses may reimplement.
1143 * </p>
1144 *
1145 * @param node the node to visit
1146 * @return <code>true</code> if the children of this node should be
1147 * visited, and <code>false</code> if the children of this node should
1148 * be skipped
1149 */
1150 public boolean visit(SimpleType node) {
1151 return true;
1152 }
1153
1154
1155 /**
1156 * Visits the given type-specific AST node.
1157 * <p>
1158 * The default implementation does nothing and return true.
1159 * Subclasses may reimplement.
1160 * </p>
1161 *
1162 * @param node the node to visit
1163 * @return <code>true</code> if the children of this node should be
1164 * visited, and <code>false</code> if the children of this node should
1165 * be skipped
1166 * @since 3.0
1167 */
1168 public boolean visit(SingleMemberAnnotation node) {
1169 return true;
1170 }
1171
1172
1173 /**
1174 * Visits the given type-specific AST node.
1175 * <p>
1176 * The default implementation does nothing and return true.
1177 * Subclasses may reimplement.
1178 * </p>
1179 *
1180 * @param node the node to visit
1181 * @return <code>true</code> if the children of this node should be
1182 * visited, and <code>false</code> if the children of this node should
1183 * be skipped
1184 */
1185 public boolean visit(SingleVariableDeclaration node) {
1186 return true;
1187 }
1188
1189 /**
1190 * Visits the given type-specific AST node.
1191 * <p>
1192 * The default implementation does nothing and return true.
1193 * Subclasses may reimplement.
1194 * </p>
1195 *
1196 * @param node the node to visit
1197 * @return <code>true</code> if the children of this node should be
1198 * visited, and <code>false</code> if the children of this node should
1199 * be skipped
1200 */
1201 public boolean visit(StringLiteral node) {
1202 return true;
1203 }
1204
1205 /**
1206 * Visits the given type-specific AST node.
1207 * <p>
1208 * The default implementation does nothing and return true.
1209 * Subclasses may reimplement.
1210 * </p>
1211 *
1212 * @param node the node to visit
1213 * @return <code>true</code> if the children of this node should be
1214 * visited, and <code>false</code> if the children of this node should
1215 * be skipped
1216 */
1217 public boolean visit(SuperConstructorInvocation node) {
1218 return true;
1219 }
1220
1221 /**
1222 * Visits the given type-specific AST node.
1223 * <p>
1224 * The default implementation does nothing and return true.
1225 * Subclasses may reimplement.
1226 * </p>
1227 *
1228 * @param node the node to visit
1229 * @return <code>true</code> if the children of this node should be
1230 * visited, and <code>false</code> if the children of this node should
1231 * be skipped
1232 */
1233 public boolean visit(SuperFieldAccess node) {
1234 return true;
1235 }
1236
1237 /**
1238 * Visits the given type-specific AST node.
1239 * <p>
1240 * The default implementation does nothing and return true.
1241 * Subclasses may reimplement.
1242 * </p>
1243 *
1244 * @param node the node to visit
1245 * @return <code>true</code> if the children of this node should be
1246 * visited, and <code>false</code> if the children of this node should
1247 * be skipped
1248 */
1249 public boolean visit(SuperMethodInvocation node) {
1250 return true;
1251 }
1252
1253 /**
1254 * Visits the given type-specific AST node.
1255 * <p>
1256 * The default implementation does nothing and return true.
1257 * Subclasses may reimplement.
1258 * </p>
1259 *
1260 * @param node the node to visit
1261 * @return <code>true</code> if the children of this node should be
1262 * visited, and <code>false</code> if the children of this node should
1263 * be skipped
1264 */
1265 public boolean visit(SwitchCase node) {
1266 return true;
1267 }
1268
1269 /**
1270 * Visits the given type-specific AST node.
1271 * <p>
1272 * The default implementation does nothing and return true.
1273 * Subclasses may reimplement.
1274 * </p>
1275 *
1276 * @param node the node to visit
1277 * @return <code>true</code> if the children of this node should be
1278 * visited, and <code>false</code> if the children of this node should
1279 * be skipped
1280 */
1281 public boolean visit(SwitchStatement node) {
1282 return true;
1283 }
1284
1285 /**
1286 * Visits the given type-specific AST node.
1287 * <p>
1288 * The default implementation does nothing and return true.
1289 * Subclasses may reimplement.
1290 * </p>
1291 *
1292 * @param node the node to visit
1293 * @return <code>true</code> if the children of this node should be
1294 * visited, and <code>false</code> if the children of this node should
1295 * be skipped
1296 */
1297 public boolean visit(SynchronizedStatement node) {
1298 return true;
1299 }
1300
1301
1302 /**
1303 * Visits the given type-specific AST node.
1304 * <p>
1305 * The default implementation does nothing and return true.
1306 * Subclasses may reimplement.
1307 * </p>
1308 *
1309 * @param node the node to visit
1310 * @return <code>true</code> if the children of this node should be
1311 * visited, and <code>false</code> if the children of this node should
1312 * be skipped
1313 * @since 3.0
1314 */
1315 public boolean visit(TagElement node) {
1316 return true;
1317 }
1318
1319
1320 /**
1321 * Visits the given type-specific AST node.
1322 * <p>
1323 * The default implementation does nothing and return true.
1324 * Subclasses may reimplement.
1325 * </p>
1326 *
1327 * @param node the node to visit
1328 * @return <code>true</code> if the children of this node should be
1329 * visited, and <code>false</code> if the children of this node should
1330 * be skipped
1331 * @since 3.0
1332 */
1333 public boolean visit(TextElement node) {
1334 return true;
1335 }
1336
1337
1338 /**
1339 * Visits the given type-specific AST node.
1340 * <p>
1341 * The default implementation does nothing and return true.
1342 * Subclasses may reimplement.
1343 * </p>
1344 *
1345 * @param node the node to visit
1346 * @return <code>true</code> if the children of this node should be
1347 * visited, and <code>false</code> if the children of this node should
1348 * be skipped
1349 */
1350 public boolean visit(ThisExpression node) {
1351 return true;
1352 }
1353
1354 /**
1355 * Visits the given type-specific AST node.
1356 * <p>
1357 * The default implementation does nothing and return true.
1358 * Subclasses may reimplement.
1359 * </p>
1360 *
1361 * @param node the node to visit
1362 * @return <code>true</code> if the children of this node should be
1363 * visited, and <code>false</code> if the children of this node should
1364 * be skipped
1365 */
1366 public boolean visit(ThrowStatement node) {
1367 return true;
1368 }
1369
1370 /**
1371 * Visits the given type-specific AST node.
1372 * <p>
1373 * The default implementation does nothing and return true.
1374 * Subclasses may reimplement.
1375 * </p>
1376 *
1377 * @param node the node to visit
1378 * @return <code>true</code> if the children of this node should be
1379 * visited, and <code>false</code> if the children of this node should
1380 * be skipped
1381 */
1382 public boolean visit(TryStatement node) {
1383 return true;
1384 }
1385
1386 /**
1387 * Visits the given type-specific AST node.
1388 * <p>
1389 * The default implementation does nothing and return true.
1390 * Subclasses may reimplement.
1391 * </p>
1392 *
1393 * @param node the node to visit
1394 * @return <code>true</code> if the children of this node should be
1395 * visited, and <code>false</code> if the children of this node should
1396 * be skipped
1397 */
1398 public boolean visit(TypeDeclaration node) {
1399 return true;
1400 }
1401
1402 /**
1403 * Visits the given type-specific AST node.
1404 * <p>
1405 * The default implementation does nothing and return true.
1406 * Subclasses may reimplement.
1407 * </p>
1408 *
1409 * @param node the node to visit
1410 * @return <code>true</code> if the children of this node should be
1411 * visited, and <code>false</code> if the children of this node should
1412 * be skipped
1413 */
1414 public boolean visit(TypeDeclarationStatement node) {
1415 return true;
1416 }
1417
1418 /**
1419 * Visits the given type-specific AST node.
1420 * <p>
1421 * The default implementation does nothing and return true.
1422 * Subclasses may reimplement.
1423 * </p>
1424 *
1425 * @param node the node to visit
1426 * @return <code>true</code> if the children of this node should be
1427 * visited, and <code>false</code> if the children of this node should
1428 * be skipped
1429 */
1430 public boolean visit(TypeLiteral node) {
1431 return true;
1432 }
1433
1434 /**
1435 * Visits the given type-specific AST node.
1436 * <p>
1437 * The default implementation does nothing and return true.
1438 * Subclasses may reimplement.
1439 * </p>
1440 *
1441 * @param node the node to visit
1442 * @return <code>true</code> if the children of this node should be
1443 * visited, and <code>false</code> if the children of this node should
1444 * be skipped
1445 * @since 3.0
1446 */
1447 public boolean visit(TypeParameter node) {
1448 return true;
1449 }
1450
1451 /**
1452 * Visits the given type-specific AST node.
1453 * <p>
1454 * The default implementation does nothing and return true.
1455 * Subclasses may reimplement.
1456 * </p>
1457 *
1458 * @param node the node to visit
1459 * @return <code>true</code> if the children of this node should be
1460 * visited, and <code>false</code> if the children of this node should
1461 * be skipped
1462 */
1463 public boolean visit(VariableDeclarationExpression node) {
1464 return true;
1465 }
1466
1467 /**
1468 * Visits the given type-specific AST node.
1469 * <p>
1470 * The default implementation does nothing and return true.
1471 * Subclasses may reimplement.
1472 * </p>
1473 *
1474 * @param node the node to visit
1475 * @return <code>true</code> if the children of this node should be
1476 * visited, and <code>false</code> if the children of this node should
1477 * be skipped
1478 */
1479 public boolean visit(VariableDeclarationStatement node) {
1480 return true;
1481 }
1482
1483 /**
1484 * Visits the given type-specific AST node.
1485 * <p>
1486 * The default implementation does nothing and return true.
1487 * Subclasses may reimplement.
1488 * </p>
1489 *
1490 * @param node the node to visit
1491 * @return <code>true</code> if the children of this node should be
1492 * visited, and <code>false</code> if the children of this node should
1493 * be skipped
1494 */
1495 public boolean visit(VariableDeclarationFragment node) {
1496 return true;
1497 }
1498
1499 /**
1500 * Visits the given type-specific AST node.
1501 * <p>
1502 * The default implementation does nothing and return true.
1503 * Subclasses may reimplement.
1504 * </p>
1505 *
1506 * @param node the node to visit
1507 * @return <code>true</code> if the children of this node should be
1508 * visited, and <code>false</code> if the children of this node should
1509 * be skipped
1510 */
1511 public boolean visit(WhileStatement node) {
1512 return true;
1513 }
1514
1515 /**
1516 * Visits the given type-specific AST node.
1517 * <p>
1518 * The default implementation does nothing and return true.
1519 * Subclasses may reimplement.
1520 * </p>
1521 *
1522 * @param node the node to visit
1523 * @return <code>true</code> if the children of this node should be
1524 * visited, and <code>false</code> if the children of this node should
1525 * be skipped
1526 * @since 3.0
1527 */
1528 public boolean visit(WildcardType node) {
1529 return true;
1530 }
1531
1532 /**
1533 * End of visit the given type-specific AST node.
1534 * <p>
1535 * The default implementation does nothing. Subclasses may reimplement.
1536 * </p>
1537 *
1538 * @param node the node to visit
1539 * @since 3.0
1540 */
1541 public void endVisit(AnnotationTypeDeclaration node) {
1542 // default implementation: do nothing
1543 }
1544
1545 /**
1546 * End of visit the given type-specific AST node.
1547 * <p>
1548 * The default implementation does nothing. Subclasses may reimplement.
1549 * </p>
1550 *
1551 * @param node the node to visit
1552 * @since 3.0
1553 */
1554 public void endVisit(AnnotationTypeMemberDeclaration node) {
1555 // default implementation: do nothing
1556 }
1557
1558 /**
1559 * End of visit the given type-specific AST node.
1560 * <p>
1561 * The default implementation does nothing. Subclasses may reimplement.
1562 * </p>
1563 *
1564 * @param node the node to visit
1565 */
1566 public void endVisit(AnonymousClassDeclaration node) {
1567 // default implementation: do nothing
1568 }
1569
1570 /**
1571 * End of visit the given type-specific AST node.
1572 * <p>
1573 * The default implementation does nothing. Subclasses may reimplement.
1574 * </p>
1575 *
1576 * @param node the node to visit
1577 */
1578 public void endVisit(ArrayAccess node) {
1579 // default implementation: do nothing
1580 }
1581
1582 /**
1583 * End of visit the given type-specific AST node.
1584 * <p>
1585 * The default implementation does nothing. Subclasses may reimplement.
1586 * </p>
1587 *
1588 * @param node the node to visit
1589 */
1590 public void endVisit(ArrayCreation node) {
1591 // default implementation: do nothing
1592 }
1593
1594 /**
1595 * End of visit the given type-specific AST node.
1596 * <p>
1597 * The default implementation does nothing. Subclasses may reimplement.
1598 * </p>
1599 *
1600 * @param node the node to visit
1601 */
1602 public void endVisit(ArrayInitializer node) {
1603 // default implementation: do nothing
1604 }
1605
1606 /**
1607 * End of visit the given type-specific AST node.
1608 * <p>
1609 * The default implementation does nothing. Subclasses may reimplement.
1610 * </p>
1611 *
1612 * @param node the node to visit
1613 */
1614 public void endVisit(ArrayType node) {
1615 // default implementation: do nothing
1616 }
1617
1618 /**
1619 * End of visit the given type-specific AST node.
1620 * <p>
1621 * The default implementation does nothing. Subclasses may reimplement.
1622 * </p>
1623 *
1624 * @param node the node to visit
1625 */
1626 public void endVisit(AssertStatement node) {
1627 // default implementation: do nothing
1628 }
1629
1630 /**
1631 * End of visit the given type-specific AST node.
1632 * <p>
1633 * The default implementation does nothing. Subclasses may reimplement.
1634 * </p>
1635 *
1636 * @param node the node to visit
1637 */
1638 public void endVisit(Assignment node) {
1639 // default implementation: do nothing
1640 }
1641
1642 /**
1643 * End of visit the given type-specific AST node.
1644 * <p>
1645 * The default implementation does nothing. Subclasses may reimplement.
1646 * </p>
1647 *
1648 * @param node the node to visit
1649 */
1650 public void endVisit(Block node) {
1651 // default implementation: do nothing
1652 }
1653
1654 /**
1655 * End of visit the given type-specific AST node.
1656 * <p>
1657 * The default implementation does nothing. Subclasses may reimplement.
1658 * </p>
1659 *
1660 * @param node the node to visit
1661 * @since 3.0
1662 */
1663 public void endVisit(BlockComment node) {
1664 // default implementation: do nothing
1665 }
1666
1667 /**
1668 * End of visit the given type-specific AST node.
1669 * <p>
1670 * The default implementation does nothing. Subclasses may reimplement.
1671 * </p>
1672 *
1673 * @param node the node to visit
1674 */
1675 public void endVisit(BooleanLiteral node) {
1676 // default implementation: do nothing
1677 }
1678
1679 /**
1680 * End of visit the given type-specific AST node.
1681 * <p>
1682 * The default implementation does nothing. Subclasses may reimplement.
1683 * </p>
1684 *
1685 * @param node the node to visit
1686 */
1687 public void endVisit(BreakStatement node) {
1688 // default implementation: do nothing
1689 }
1690
1691 /**
1692 * End of visit the given type-specific AST node.
1693 * <p>
1694 * The default implementation does nothing. Subclasses may reimplement.
1695 * </p>
1696 *
1697 * @param node the node to visit
1698 */
1699 public void endVisit(CastExpression node) {
1700 // default implementation: do nothing
1701 }
1702
1703 /**
1704 * End of visit the given type-specific AST node.
1705 * <p>
1706 * The default implementation does nothing. Subclasses may reimplement.
1707 * </p>
1708 *
1709 * @param node the node to visit
1710 */
1711 public void endVisit(CatchClause node) {
1712 // default implementation: do nothing
1713 }
1714
1715 /**
1716 * End of visit the given type-specific AST node.
1717 * <p>
1718 * The default implementation does nothing. Subclasses may reimplement.
1719 * </p>
1720 *
1721 * @param node the node to visit
1722 */
1723 public void endVisit(CharacterLiteral node) {
1724 // default implementation: do nothing
1725 }
1726
1727 /**
1728 * End of visit the given type-specific AST node.
1729 * <p>
1730 * The default implementation does nothing. Subclasses may reimplement.
1731 * </p>
1732 *
1733 * @param node the node to visit
1734 */
1735 public void endVisit(ClassInstanceCreation node) {
1736 // default implementation: do nothing
1737 }
1738
1739 /**
1740 * End of visit the given type-specific AST node.
1741 * <p>
1742 * The default implementation does nothing. Subclasses may reimplement.
1743 * </p>
1744 *
1745 * @param node the node to visit
1746 */
1747 public void endVisit(CompilationUnit node) {
1748 // default implementation: do nothing
1749 }
1750
1751 /**
1752 * End of visit the given type-specific AST node.
1753 * <p>
1754 * The default implementation does nothing. Subclasses may reimplement.
1755 * </p>
1756 *
1757 * @param node the node to visit
1758 */
1759 public void endVisit(ConditionalExpression node) {