Source Code Cross Referenced for TypeNode.java in  » IDE » tIDE » javaparser » 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 » IDE » tIDE » javaparser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package javaparser;
002:
003:        import javaparser.javacc_gen.*;
004:        import java.util.*;
005:        import tide.syntaxtree.*;
006:
007:        /** A type is a class, an interface an enum an annotation defined
008:         at first level of a source.
009:         Subclasses: ClassNode, ...
010:         */
011:        public abstract class TypeNode extends ParserTreeNode implements 
012:                TypeInterface, NodeWithMod {
013:            // the limits of this type
014:            public Token blokStart, blokEnd;
015:            //  protected SimplifiedSyntaxTree simplifiedSyntaxTree;
016:            protected SimplifiedSyntaxTree2 simplifiedSyntaxTree2;
017:            public TypeNode parentType;
018:
019:            // not used in the tree
020:            public List<TypeNode> directChildTypes = new ArrayList<TypeNode>();
021:
022:            // raw tree reference. Used for real time later parsing
023:            //  also used during
024:            // public ParserTreeNode rawDeclarationNode;
025:            public RAWParserTreeNode rawDeclarationNode2;
026:
027:            // TODO:
028:            // interesting for completion: the ClassOrInterfaceBodyDeclaration tokens that are NOT subchilds type declarations
029:            // but anonymous instanciations with body.
030:            //   for example new ActionListener() { ... }
031:
032:            /*
033:             public TypeNode(String descr, SimplifiedSyntaxTree sst, TypeNode parentType, ParserTreeNode rawDeclarationNode)
034:             {
035:             super(descr);
036:
037:             this.sortPriority = 5;
038:
039:             this.simplifiedSyntaxTree = sst;
040:             this.parentType = parentType;
041:             this.rawDeclarationNode = rawDeclarationNode;
042:
043:             if(parentType!=null)
044:             {
045:             parentType.directChildTypes.add(this);
046:             }
047:             }*/
048:
049:            public TypeNode(String descr, SimplifiedSyntaxTree2 sst,
050:                    TypeNode parentType, RAWParserTreeNode rawDeclarationNode2) {
051:                super (descr);
052:
053:                this .sortPriority = 5;
054:
055:                this .simplifiedSyntaxTree2 = sst;
056:                this .parentType = parentType;
057:                this .rawDeclarationNode2 = rawDeclarationNode2;
058:
059:                if (parentType != null) {
060:                    parentType.directChildTypes.add(this );
061:                }
062:            }
063:
064:            /** Simple name, without the parent.
065:             */
066:            public abstract String getTypeSimpleName();
067:
068:            public abstract boolean isPublic();
069:
070:            /** With the package name.
071:             */
072:            public abstract String getJavaFullName();
073:
074:            /** The name without the package. Constructed from the simple name and the parents chain.
075:             */
076:            public String getTypeRelativeName() {
077:                StringBuilder sb = new StringBuilder();
078:                sb.append(getTypeSimpleName());
079:                TypeNode pn = this .parentType;
080:                while (pn != null) {
081:                    sb.insert(0, ".");
082:                    sb.insert(0, pn.getTypeSimpleName());
083:                    pn = pn.parentType;
084:                }
085:                return sb.toString();
086:            }
087:
088:            /** To detect if public or static, use Utils.contains(mods, JavaParserConstants.PUBLIC)
089:             */
090:            public abstract int[] getModifiers();
091:
092:            /** null if none
093:              looks in the declared subchilds, but not actually in the anonymous declared classes
094:             */
095:            @edu.umd.cs.findbugs.annotations.CheckForNull
096:            public TypeNode getDeepestContainingTypeAt(int line, int col) {
097:                if (!TreeUtils.contains(this , line, col))
098:                    return null;
099:
100:                // deepest => look in childs
101:                for (TypeNode tn : this .directChildTypes) {
102:                    TypeNode found = tn.getDeepestContainingTypeAt(line, col);
103:                    if (found != null)
104:                        return found;
105:                }
106:
107:                // not found in childs => this is the deepest
108:                return this ;
109:            }
110:
111:            /** Interesting for completion: the ClassOrInterfaceBodyDeclaration tokens that are NOT subchilds type declarations
112:              but anonymous instanciations with body.
113:              for example new ActionListener() { ... }
114:
115:              this is called at completion time
116:             */
117:            public AnonymousType getDeepestContainingAnonymousClassBlocForLocation(
118:                    int line, int col) {
119:                List<RAWParserTreeNode> found = new ArrayList<RAWParserTreeNode>();
120:                if (rawDeclarationNode2 == null) {
121:                    System.out
122:                            .println("No raw tree found for deepest type search.");
123:                    return null;
124:                }
125:                CCTreeUtils.getAllChildsNamed(rawDeclarationNode2,
126:                        "ClassOrInterfaceBody", found); // TODO: annotations ?, enums ?
127:                //System.out.println("\n"+found.size()+" declaration found:");
128:
129:                for (RAWParserTreeNode tn : found) {
130:                    //System.out.println("\nDecl at line "+tn.getStartLinCol()[0]);
131:                    AnonymousType at = AnonymousType.parse(tn, this );
132:                    if (at != null) {
133:                        if (Utils.isInto(line, col, at.start, at.end)) {
134:                            //System.out.println("found anonymous type "+at.name);
135:                            //new Throwable().printStackTrace();
136:                            return at;
137:                        }
138:                    }
139:                }
140:
141:                return null;
142:            }
143:
144:            /** Call this to help GC !
145:             */
146:            @Override
147:            public void terminate() {
148:                super .terminate();
149:
150:                simplifiedSyntaxTree2 = null;
151:                parentType = null;
152:                directChildTypes.clear();
153:                //rawDeclarationNode = null;
154:                rawDeclarationNode2 = null;
155:                blokEnd = null;
156:                blokStart = null;
157:            }
158:
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.