|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jdt.core.dom.ASTVisitor
A visitor for abstract syntax trees.
For each different concrete AST node type
public boolean visit(T node)
- Visits
the given node to perform some arbitrary operation. If true
is returned, the given node's child nodes will be visited next; however,
if false
is returned, the given node's child nodes will
not be visited. The default implementation provided by this class does
nothing and returns true
. Subclasses may reimplement
this method as needed.public void endVisit(T node)
- Visits
the given node to perform some arbitrary operation. When used in the
conventional way, this method is called after all of the given node's
children have been visited (or immediately, if visit
returned
false
). The default implementation provided by this class does
nothing. Subclasses may reimplement this method as needed.public void preVisit(ASTNode node)
- Visits
the given node to perform some arbitrary operation.
This method is invoked prior to the appropriate type-specific
visit
method.
The default implementation of this method does nothing.
Subclasses may reimplement this method as needed.public void postVisit(ASTNode node)
- Visits
the given node to perform some arbitrary operation.
This method is invoked after the appropriate type-specific
endVisit
method.
The default implementation of this method does nothing.
Subclasses may reimplement this method as needed.For nodes with list-valued properties, the child nodes within the list are visited in order. For nodes with multiple properties, the child nodes are visited in the order that most closely corresponds to the lexical reading order of the source program. For instance, for a type declaration node, the child ordering is: name, superclass, superinterfaces, and body declarations.
While it is possible to modify the tree in the visitor, care is required to
ensure that the consequences are as expected and desirable.
During the course of an ordinary visit starting at a given node, every node
in the subtree is visited exactly twice, first with visit
and
then with endVisit
. During a traversal of a stationary tree,
each node is either behind (after endVisit
), ahead (before
visit
), or in progress (between visit
and
the matching endVisit
). Changes to the "behind" region of the
tree are of no consequence to the visit in progress. Changes to the "ahead"
region will be taken in stride. Changes to the "in progress" portion are
the more interesting cases. With a node, the various properties are arranged
in a linear list, with a cursor that separates the properties that have
been visited from the ones that are still to be visited (the cursor
is between the elements, rather than on an element). The cursor moves from
the head to the tail of this list, advancing to the next position just
visit
if called for that child. After the child
subtree has been completely visited, the visit moves on the child
immediately after the cursor. Removing a child while it is being visited
does not alter the course of the visit. But any children added at positions
after the cursor are considered in the "ahead" portion and will be visited.
Cases to watch out for:
ASTNode.accept(org.eclipse.jdt.core.dom.ASTVisitor)
Constructor Summary | |
ASTVisitor()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ASTVisitor()
Method Detail |
public void preVisit(ASTNode node)
visit
).
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void postVisit(ASTNode node)
endVisit
).
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic boolean visit(AnonymousClassDeclaration node)
public boolean visit(ArrayAccess node)
public boolean visit(ArrayCreation node)
public boolean visit(ArrayInitializer node)
public boolean visit(ArrayType node)
public boolean visit(AssertStatement node)
public boolean visit(Assignment node)
public boolean visit(Block node)
public boolean visit(BooleanLiteral node)
public boolean visit(BreakStatement node)
public boolean visit(CastExpression node)
public boolean visit(CatchClause node)
public boolean visit(CharacterLiteral node)
public boolean visit(ClassInstanceCreation node)
public boolean visit(CompilationUnit node)
public boolean visit(ConditionalExpression node)
public boolean visit(ConstructorInvocation node)
public boolean visit(ContinueStatement node)
public boolean visit(DoStatement node)
public boolean visit(EmptyStatement node)
public boolean visit(ExpressionStatement node)
public boolean visit(FieldAccess node)
public boolean visit(FieldDeclaration node)
public boolean visit(ForStatement node)
public boolean visit(IfStatement node)
public boolean visit(ImportDeclaration node)
public boolean visit(InfixExpression node)
public boolean visit(InstanceofExpression node)
public boolean visit(Initializer node)
public boolean visit(Javadoc node)
public boolean visit(LabeledStatement node)
public boolean visit(MethodDeclaration node)
public boolean visit(MethodInvocation node)
public boolean visit(NullLiteral node)
public boolean visit(NumberLiteral node)
public boolean visit(PackageDeclaration node)
public boolean visit(ParenthesizedExpression node)
public boolean visit(PostfixExpression node)
public boolean visit(PrefixExpression node)
public boolean visit(PrimitiveType node)
public boolean visit(QualifiedName node)
public boolean visit(ReturnStatement node)
public boolean visit(SimpleName node)
public boolean visit(SimpleType node)
public boolean visit(StringLiteral node)
public boolean visit(SuperConstructorInvocation node)
public boolean visit(SuperFieldAccess node)
public boolean visit(SuperMethodInvocation node)
public boolean visit(SwitchCase node)
public boolean visit(SwitchStatement node)
public boolean visit(SynchronizedStatement node)
public boolean visit(ThisExpression node)
public boolean visit(ThrowStatement node)
public boolean visit(TryStatement node)
public boolean visit(TypeDeclaration node)
public boolean visit(TypeDeclarationStatement node)
public boolean visit(TypeLiteral node)
public boolean visit(SingleVariableDeclaration node)
public boolean visit(VariableDeclarationExpression node)
public boolean visit(VariableDeclarationStatement node)
public boolean visit(VariableDeclarationFragment node)
public boolean visit(WhileStatement node)
public void endVisit(AnonymousClassDeclaration node)
public void endVisit(ArrayAccess node)
public void endVisit(ArrayCreation node)
public void endVisit(ArrayInitializer node)
public void endVisit(ArrayType node)
public void endVisit(AssertStatement node)
public void endVisit(Assignment node)
public void endVisit(Block node)
public void endVisit(BooleanLiteral node)
public void endVisit(BreakStatement node)
public void endVisit(CastExpression node)
public void endVisit(CatchClause node)
public void endVisit(CharacterLiteral node)
public void endVisit(ClassInstanceCreation node)
public void endVisit(CompilationUnit node)
public void endVisit(ConditionalExpression node)
public void endVisit(ConstructorInvocation node)
public void endVisit(ContinueStatement node)
public void endVisit(DoStatement node)
public void endVisit(EmptyStatement node)
public void endVisit(ExpressionStatement node)
public void endVisit(FieldAccess node)
public void endVisit(FieldDeclaration node)
public void endVisit(ForStatement node)
public void endVisit(IfStatement node)
public void endVisit(ImportDeclaration node)
public void endVisit(InfixExpression node)
public void endVisit(InstanceofExpression node)
public void endVisit(Initializer node)
public void endVisit(Javadoc node)
public void endVisit(LabeledStatement node)
public void endVisit(MethodDeclaration node)
public void endVisit(MethodInvocation node)
public void endVisit(NullLiteral node)
public void endVisit(NumberLiteral node)
public void endVisit(PackageDeclaration node)
public void endVisit(ParenthesizedExpression node)
public void endVisit(PostfixExpression node)
public void endVisit(PrefixExpression node)
public void endVisit(PrimitiveType node)
public void endVisit(QualifiedName node)
public void endVisit(ReturnStatement node)
public void endVisit(SimpleName node)
public void endVisit(SimpleType node)
public void endVisit(StringLiteral node)
public void endVisit(SuperConstructorInvocation node)
public void endVisit(SuperFieldAccess node)
public void endVisit(SuperMethodInvocation node)
public void endVisit(SwitchCase node)
public void endVisit(SwitchStatement node)
public void endVisit(SynchronizedStatement node)
public void endVisit(ThisExpression node)
public void endVisit(ThrowStatement node)
public void endVisit(TryStatement node)
public void endVisit(TypeDeclaration node)
public void endVisit(TypeDeclarationStatement node)
public void endVisit(TypeLiteral node)
public void endVisit(SingleVariableDeclaration node)
public void endVisit(VariableDeclarationExpression node)
public void endVisit(VariableDeclarationStatement node)
public void endVisit(VariableDeclarationFragment node)
public void endVisit(WhileStatement node)
|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |