Java Doc for TreeScanner.java in  » 6.0-JDK-Modules-sun » javac-compiler » com » sun » source » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules sun » javac compiler » com.sun.source.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.source.util.TreeScanner

TreeScanner
public class TreeScanner implements TreeVisitor<R, P>(Code)
A TreeVisitor that visits all the child tree nodes. To visit nodes of a particular type, just override the corresponding visitXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes.

The default implementation of the visitXYZ methods will determine a result as follows:

  • If the node being visited has no children, the result will be null.
  • If the node being visited has one child, the result will be the result of calling scan on that child. The child may be a simple node or itself a list of nodes.
  • If the node being visited has more than one child, the result will be determined by calling scan each child in turn, and then combining the result of each scan after the first with the cumulative result so far, as determined by the TreeScanner.reduce method. Each child may be either a simple node of a list of nodes. The default behavior of the reduce method is such that the result of the visitXYZ method will be the result of the last child scanned.

Here is an example to count the number of identifier nodes in a tree:

 class CountIdentifiers extends TreeScanner {
 Override
 public Integer visitIdentifier(IdentifierTree node, Void p) { 
 return 1; 
 }
 Override
 public Integer reduce(Integer r1, Integer r2) { 
 return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2); 
 }
 }
 

author:
   Peter von der Ahé
author:
   Jonathan Gibbons
since:
   1.6




Method Summary
public  Rreduce(R r1, R r2)
     Reduces two results into a combined result.
public  Rscan(Tree node, P p)
     Scan a single node.
public  Rscan(Iterable<? extends Tree> nodes, P p)
     Scan a list of nodes.
public  RvisitAnnotation(AnnotationTree node, P p)
    
public  RvisitArrayAccess(ArrayAccessTree node, P p)
    
public  RvisitArrayType(ArrayTypeTree node, P p)
    
public  RvisitAssert(AssertTree node, P p)
    
public  RvisitAssignment(AssignmentTree node, P p)
    
public  RvisitBinary(BinaryTree node, P p)
    
public  RvisitBlock(BlockTree node, P p)
    
public  RvisitBreak(BreakTree node, P p)
    
public  RvisitCase(CaseTree node, P p)
    
public  RvisitCatch(CatchTree node, P p)
    
public  RvisitClass(ClassTree node, P p)
    
public  RvisitCompilationUnit(CompilationUnitTree node, P p)
    
public  RvisitCompoundAssignment(CompoundAssignmentTree node, P p)
    
public  RvisitConditionalExpression(ConditionalExpressionTree node, P p)
    
public  RvisitContinue(ContinueTree node, P p)
    
public  RvisitDoWhileLoop(DoWhileLoopTree node, P p)
    
public  RvisitEmptyStatement(EmptyStatementTree node, P p)
    
public  RvisitEnhancedForLoop(EnhancedForLoopTree node, P p)
    
public  RvisitErroneous(ErroneousTree node, P p)
    
public  RvisitExpressionStatement(ExpressionStatementTree node, P p)
    
public  RvisitForLoop(ForLoopTree node, P p)
    
public  RvisitIdentifier(IdentifierTree node, P p)
    
public  RvisitIf(IfTree node, P p)
    
public  RvisitImport(ImportTree node, P p)
    
public  RvisitInstanceOf(InstanceOfTree node, P p)
    
public  RvisitLabeledStatement(LabeledStatementTree node, P p)
    
public  RvisitLiteral(LiteralTree node, P p)
    
public  RvisitMemberSelect(MemberSelectTree node, P p)
    
public  RvisitMethod(MethodTree node, P p)
    
public  RvisitMethodInvocation(MethodInvocationTree node, P p)
    
public  RvisitModifiers(ModifiersTree node, P p)
    
public  RvisitNewArray(NewArrayTree node, P p)
    
public  RvisitNewClass(NewClassTree node, P p)
    
public  RvisitOther(Tree node, P p)
    
public  RvisitParameterizedType(ParameterizedTypeTree node, P p)
    
public  RvisitParenthesized(ParenthesizedTree node, P p)
    
public  RvisitPrimitiveType(PrimitiveTypeTree node, P p)
    
public  RvisitReturn(ReturnTree node, P p)
    
public  RvisitSwitch(SwitchTree node, P p)
    
public  RvisitSynchronized(SynchronizedTree node, P p)
    
public  RvisitThrow(ThrowTree node, P p)
    
public  RvisitTry(TryTree node, P p)
    
public  RvisitTypeCast(TypeCastTree node, P p)
    
public  RvisitTypeParameter(TypeParameterTree node, P p)
    
public  RvisitUnary(UnaryTree node, P p)
    
public  RvisitVariable(VariableTree node, P p)
    
public  RvisitWhileLoop(WhileLoopTree node, P p)
    
public  RvisitWildcard(WildcardTree node, P p)
    



Method Detail
reduce
public R reduce(R r1, R r2)(Code)
Reduces two results into a combined result. The default implementation is to return the first parameter. The general contract of the method is that it may take any action whatsoever.



scan
public R scan(Tree node, P p)(Code)
Scan a single node.



scan
public R scan(Iterable<? extends Tree> nodes, P p)(Code)
Scan a list of nodes.



visitAnnotation
public R visitAnnotation(AnnotationTree node, P p)(Code)



visitArrayAccess
public R visitArrayAccess(ArrayAccessTree node, P p)(Code)



visitArrayType
public R visitArrayType(ArrayTypeTree node, P p)(Code)



visitAssert
public R visitAssert(AssertTree node, P p)(Code)



visitAssignment
public R visitAssignment(AssignmentTree node, P p)(Code)



visitBinary
public R visitBinary(BinaryTree node, P p)(Code)



visitBlock
public R visitBlock(BlockTree node, P p)(Code)



visitBreak
public R visitBreak(BreakTree node, P p)(Code)



visitCase
public R visitCase(CaseTree node, P p)(Code)



visitCatch
public R visitCatch(CatchTree node, P p)(Code)



visitClass
public R visitClass(ClassTree node, P p)(Code)



visitCompilationUnit
public R visitCompilationUnit(CompilationUnitTree node, P p)(Code)



visitCompoundAssignment
public R visitCompoundAssignment(CompoundAssignmentTree node, P p)(Code)



visitConditionalExpression
public R visitConditionalExpression(ConditionalExpressionTree node, P p)(Code)



visitContinue
public R visitContinue(ContinueTree node, P p)(Code)



visitDoWhileLoop
public R visitDoWhileLoop(DoWhileLoopTree node, P p)(Code)



visitEmptyStatement
public R visitEmptyStatement(EmptyStatementTree node, P p)(Code)



visitEnhancedForLoop
public R visitEnhancedForLoop(EnhancedForLoopTree node, P p)(Code)



visitErroneous
public R visitErroneous(ErroneousTree node, P p)(Code)



visitExpressionStatement
public R visitExpressionStatement(ExpressionStatementTree node, P p)(Code)



visitForLoop
public R visitForLoop(ForLoopTree node, P p)(Code)



visitIdentifier
public R visitIdentifier(IdentifierTree node, P p)(Code)



visitIf
public R visitIf(IfTree node, P p)(Code)



visitImport
public R visitImport(ImportTree node, P p)(Code)



visitInstanceOf
public R visitInstanceOf(InstanceOfTree node, P p)(Code)



visitLabeledStatement
public R visitLabeledStatement(LabeledStatementTree node, P p)(Code)



visitLiteral
public R visitLiteral(LiteralTree node, P p)(Code)



visitMemberSelect
public R visitMemberSelect(MemberSelectTree node, P p)(Code)



visitMethod
public R visitMethod(MethodTree node, P p)(Code)



visitMethodInvocation
public R visitMethodInvocation(MethodInvocationTree node, P p)(Code)



visitModifiers
public R visitModifiers(ModifiersTree node, P p)(Code)



visitNewArray
public R visitNewArray(NewArrayTree node, P p)(Code)



visitNewClass
public R visitNewClass(NewClassTree node, P p)(Code)



visitOther
public R visitOther(Tree node, P p)(Code)



visitParameterizedType
public R visitParameterizedType(ParameterizedTypeTree node, P p)(Code)



visitParenthesized
public R visitParenthesized(ParenthesizedTree node, P p)(Code)



visitPrimitiveType
public R visitPrimitiveType(PrimitiveTypeTree node, P p)(Code)



visitReturn
public R visitReturn(ReturnTree node, P p)(Code)



visitSwitch
public R visitSwitch(SwitchTree node, P p)(Code)



visitSynchronized
public R visitSynchronized(SynchronizedTree node, P p)(Code)



visitThrow
public R visitThrow(ThrowTree node, P p)(Code)



visitTry
public R visitTry(TryTree node, P p)(Code)



visitTypeCast
public R visitTypeCast(TypeCastTree node, P p)(Code)



visitTypeParameter
public R visitTypeParameter(TypeParameterTree node, P p)(Code)



visitUnary
public R visitUnary(UnaryTree node, P p)(Code)



visitVariable
public R visitVariable(VariableTree node, P p)(Code)



visitWhileLoop
public R visitWhileLoop(WhileLoopTree node, P p)(Code)



visitWildcard
public R visitWildcard(WildcardTree node, P p)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.