KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > source > tree > TreeVisitor


1 /*
2  * @(#)TreeVisitor.java 1.4 06/08/03
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  *
7  * Use and Distribution is subject to the Java Research License available
8  * at <http://www.sun.com/software/communitysource/jrl.html>.
9  */

10
11 package com.sun.source.tree;
12
13 /**
14  * A visitor of trees, in the style of the visitor design pattern.
15  * Classes implementing this interface are used to operate
16  * on a tree when the kind of tree is unknown at compile time.
17  * When a visitor is passed to an tree's {@link Tree#accept
18  * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
19  * to that tree is invoked.
20  *
21  * <p> Classes implementing this interface may or may not throw a
22  * {@code NullPointerException} if the additional parameter {@code p}
23  * is {@code null}; see documentation of the implementing class for
24  * details.
25  *
26  * <p> <b>WARNING:</b> It is possible that methods will be added to
27  * this interface to accommodate new, currently unknown, language
28  * structures added to future versions of the Java&trade; programming
29  * language. Therefore, visitor classes directly implementing this
30  * interface may be source incompatible with future versions of the
31  * platform.
32  *
33  * @param <R> the return type of this visitor's methods. Use {@link
34  * Void} for visitors that do not need to return results.
35  * @param <P> the type of the additional parameter to this visitor's
36  * methods. Use {@code Void} for visitors that do not need an
37  * additional parameter.
38  *
39  * @author Peter von der Ah&eacute;
40  * @author Jonathan Gibbons
41  *
42  * @since 1.6
43  */

44 public interface TreeVisitor<R,P> {
45     R visitAnnotation(AnnotationTree node, P p);
46     R visitMethodInvocation(MethodInvocationTree node, P p);
47     R visitAssert(AssertTree node, P p);
48     R visitAssignment(AssignmentTree node, P p);
49     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
50     R visitBinary(BinaryTree node, P p);
51     R visitBlock(BlockTree node, P p);
52     R visitBreak(BreakTree node, P p);
53     R visitCase(CaseTree node, P p);
54     R visitCatch(CatchTree node, P p);
55     R visitClass(ClassTree node, P p);
56     R visitConditionalExpression(ConditionalExpressionTree node, P p);
57     R visitContinue(ContinueTree node, P p);
58     R visitDoWhileLoop(DoWhileLoopTree node, P p);
59     R visitErroneous(ErroneousTree node, P p);
60     R visitExpressionStatement(ExpressionStatementTree node, P p);
61     R visitEnhancedForLoop(EnhancedForLoopTree node, P p);
62     R visitForLoop(ForLoopTree node, P p);
63     R visitIdentifier(IdentifierTree node, P p);
64     R visitIf(IfTree node, P p);
65     R visitImport(ImportTree node, P p);
66     R visitArrayAccess(ArrayAccessTree node, P p);
67     R visitLabeledStatement(LabeledStatementTree node, P p);
68     R visitLiteral(LiteralTree node, P p);
69     R visitMethod(MethodTree node, P p);
70     R visitModifiers(ModifiersTree node, P p);
71     R visitNewArray(NewArrayTree node, P p);
72     R visitNewClass(NewClassTree node, P p);
73     R visitParenthesized(ParenthesizedTree node, P p);
74     R visitReturn(ReturnTree node, P p);
75     R visitMemberSelect(MemberSelectTree node, P p);
76     R visitEmptyStatement(EmptyStatementTree node, P p);
77     R visitSwitch(SwitchTree node, P p);
78     R visitSynchronized(SynchronizedTree node, P p);
79     R visitThrow(ThrowTree node, P p);
80     R visitCompilationUnit(CompilationUnitTree node, P p);
81     R visitTry(TryTree node, P p);
82     R visitParameterizedType(ParameterizedTypeTree node, P p);
83     R visitArrayType(ArrayTypeTree node, P p);
84     R visitTypeCast(TypeCastTree node, P p);
85     R visitPrimitiveType(PrimitiveTypeTree node, P p);
86     R visitTypeParameter(TypeParameterTree node, P p);
87     R visitInstanceOf(InstanceOfTree node, P p);
88     R visitUnary(UnaryTree node, P p);
89     R visitVariable(VariableTree node, P p);
90     R visitWhileLoop(WhileLoopTree node, P p);
91     R visitWildcard(WildcardTree node, P p);
92     R visitOther(Tree node, P p);
93 }
94
Popular Tags