Source Code Cross Referenced for ASTClassOrInterfaceType.java in  » UML » jrefactory » net » sourceforge » jrefactory » ast » 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 » UML » jrefactory » net.sourceforge.jrefactory.ast 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Author: Mike Atkinson
003:         *
004:         *  This software has been developed under the copyleft
005:         *  rules of the GNU General Public License.  Please
006:         *  consult the GNU General Public License for more
007:         *  details about use and distribution of this software.
008:         */
009:        package net.sourceforge.jrefactory.ast;
010:
011:        import java.util.*;
012:        import net.sourceforge.jrefactory.ast.Node;
013:        import net.sourceforge.jrefactory.parser.JavaParser;
014:        import net.sourceforge.jrefactory.parser.JavaParserTreeConstants;
015:        import net.sourceforge.jrefactory.parser.JavaParserVisitor;
016:        import net.sourceforge.jrefactory.parser.NamedToken;
017:        import net.sourceforge.jrefactory.parser.Token;
018:
019:        /**
020:         *  Description of the Class
021:         *
022:         * @author    Mike Atkinson
023:         * @since     jRefactory 2.9.0, created October 16, 2003
024:         */
025:        public class ASTClassOrInterfaceType extends ASTName {
026:            /**
027:             *  Constructor for the ASTClassOrInterfaceType node.
028:             *
029:             * @param  identifier  The id of this node (JJTCLASSORINTERFACETYPE).
030:             */
031:            public ASTClassOrInterfaceType(int identifier) {
032:                super (identifier);
033:            }
034:
035:            /**
036:             *  Constructor for the ASTClassOrInterfaceType node.
037:             *
038:             * @param  parser      The JavaParser that created this ASTClassOrInterfaceType node.
039:             * @param  identifier  The id of this node (JJTCLASSORINTERFACETYPE).
040:             */
041:            public ASTClassOrInterfaceType(JavaParser parser, int identifier) {
042:                super (parser, identifier);
043:            }
044:
045:            /**
046:             *  Constructor for the ASTClassOrInterfaceType node.
047:             *
048:             * @param  name  The name of the class or interface.
049:             */
050:            public ASTClassOrInterfaceType(ASTName name) {
051:                super (JavaParserTreeConstants.JJTCLASSORINTERFACETYPE);
052:                children = name.children;
053:            }
054:
055:            /**
056:             *  Accept the visitor. *
057:             *
058:             * @param  visitor  An implementation of JavaParserVisitor that processes the ASTClassOrInterfaceType node.
059:             * @param  data     Some data being passed between the visitor methods.
060:             * @return          Usually the data parameter (possibly modified).
061:             */
062:            public Object jjtAccept(JavaParserVisitor visitor, Object data) {
063:                return visitor.visit(this , data);
064:            }
065:
066:            /**
067:             *  Determines if two names start with the same series of items
068:             *
069:             * @param  otherName  Description of Parameter
070:             * @return            Description of the Returned Value
071:             */
072:            public boolean startsWith(ASTClassOrInterfaceType otherName) {
073:                //  To start with the other name, the other name must be less than or equal in parts
074:                if (otherName.getNameSize() > getNameSize()) {
075:                    return false;
076:                }
077:
078:                //  Look for the point where they are different
079:                int last = Math.min(otherName.getNameSize(), getNameSize());
080:                for (int ndx = 0; ndx < last; ndx++) {
081:                    if (!getNamePart(ndx).equals(otherName.getNamePart(ndx))) {
082:                        return false;
083:                    }
084:                }
085:
086:                //  They must be the same
087:                return true;
088:            }
089:
090:            /**
091:             *  Change starting part. Presumes that otherName is less than the length of the current name.
092:             *
093:             * @param  oldBase  Description of Parameter
094:             * @param  newBase  Description of Parameter
095:             * @return          Description of the Returned Value
096:             */
097:            public ASTClassOrInterfaceType changeStartingPart(
098:                    ASTClassOrInterfaceType oldBase,
099:                    ASTClassOrInterfaceType newBase) {
100:                ASTClassOrInterfaceType result = new ASTClassOrInterfaceType(
101:                        JavaParserTreeConstants.JJTCLASSORINTERFACETYPE);
102:
103:                int last = newBase.getNameSize();
104:                for (int ndx = 0; ndx < last; ndx++) {
105:                    result.addNamePart(newBase.getNamePart(ndx));
106:                }
107:
108:                int end = getNameSize();
109:                int start = oldBase.getNameSize();
110:                for (int ndx = start; ndx < end; ndx++) {
111:                    result.addNamePart(getNamePart(ndx));
112:                }
113:                result.setLineAndColumnInfo(getBeginLine(), getBeginColumn(),
114:                        getEndLine(), getEndColumn());
115:
116:                return result;
117:            }
118:
119:            /**
120:             *  Change starting part. Presumes that otherName is less than the length of the current name.
121:             *
122:             * @param  oldBase  Description of Parameter
123:             * @param  newBase  Description of Parameter
124:             * @return          Description of the Returned Value
125:             */
126:            public ASTClassOrInterfaceType changeStartingPart(
127:                    ASTClassOrInterfaceType oldBase, ASTName newBase) {
128:                ASTClassOrInterfaceType result = new ASTClassOrInterfaceType(
129:                        JavaParserTreeConstants.JJTCLASSORINTERFACETYPE);
130:
131:                int last = newBase.getNameSize();
132:                for (int ndx = 0; ndx < last; ndx++) {
133:                    result.addNamePart(newBase.getNamePart(ndx));
134:                }
135:
136:                int end = getNameSize();
137:                int start = oldBase.getNameSize();
138:                for (int ndx = start; ndx < end; ndx++) {
139:                    result.addNamePart(getNamePart(ndx));
140:                }
141:                result.setLineAndColumnInfo(getBeginLine(), getBeginColumn(),
142:                        getEndLine(), getEndColumn());
143:
144:                return result;
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.