Source Code Cross Referenced for RenameMethodData.java in  » UML » jrefactory » org » acm » seguin » refactor » method » 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 » org.acm.seguin.refactor.method 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Author:  Chris Seguin
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 org.acm.seguin.refactor.method;
010:
011:        import org.acm.seguin.refactor.ComplexTransform;
012:        import org.acm.seguin.summary.MethodSummary;
013:        import org.acm.seguin.summary.PackageSummary;
014:        import org.acm.seguin.summary.Summary;
015:        import org.acm.seguin.summary.TypeSummary;
016:        import org.acm.seguin.summary.query.Ancestor;
017:
018:        /**
019:         *  Object used to store the state of the rename method visitor
020:         *
021:         * @author    Mike Atkinson
022:         * @since     2.9.11
023:         */
024:        class RenameMethodData {
025:            private String oldName;
026:            private String newName;
027:            private boolean this Required;
028:            private Summary current;
029:            private boolean mustInsertThis;
030:            private TypeSummary typeSummary;
031:            private boolean canBeFirst;
032:            private boolean canBeThis;
033:            private MethodSummary oldMethod;
034:            private ComplexTransform transform;
035:            private String fullName;
036:            private String importedName;
037:
038:            /**
039:             *  Constructor for the RenameFieldData object
040:             *
041:             *@param  newName   the new field name
042:             *@param  oldField  Description of Parameter
043:             */
044:            public RenameMethodData(MethodSummary oldMethod, String newName) {
045:                this .oldName = oldMethod.getName();
046:                this .newName = newName;
047:                this .oldMethod = oldMethod;
048:                this Required = false;
049:                canBeFirst = false;
050:                canBeThis = false;
051:                mustInsertThis = false;
052:                current = null;
053:                typeSummary = (TypeSummary) oldMethod.getParent();
054:                initNames(oldMethod);
055:            }
056:
057:            /**
058:             *  Constructor for the RenameFieldData object
059:             *
060:             *@param  newName    the new field name
061:             *@param  oldField   Description of Parameter
062:             *@param  transform  Description of Parameter
063:             */
064:            public RenameMethodData(MethodSummary oldMethod, String newName,
065:                    ComplexTransform transform) {
066:                this .newName = newName;
067:                this .oldMethod = oldMethod;
068:                this .transform = transform;
069:                oldName = oldMethod.getName();
070:                typeSummary = (TypeSummary) oldMethod.getParent();
071:            }
072:
073:            /**
074:             *  Sets the ThisRequired attribute of the RenameFieldData object
075:             *
076:             *@param  way  The new ThisRequired value
077:             */
078:            public void setThisRequired(boolean way) {
079:                this Required = way;
080:            }
081:
082:            /**
083:             *  Sets the CurrentSummary attribute of the RenameFieldData object
084:             *
085:             *@param  value  The new CurrentSummary value
086:             */
087:            public void setCurrentSummary(Summary value) {
088:                current = value;
089:                if (current instanceof  TypeSummary) {
090:                    check((TypeSummary) current);
091:                }
092:            }
093:
094:            /**
095:             *  Sets the MustInsertThis attribute of the RenameFieldData object
096:             *
097:             *@param  value  The new MustInsertThis value
098:             */
099:            public void setMustInsertThis(boolean value) {
100:                mustInsertThis = value;
101:            }
102:
103:            /**
104:             *  Gets the OldName attribute of the RenameFieldData object
105:             *
106:             *@return    The OldName value
107:             */
108:            public String getOldName() {
109:                return oldName;
110:            }
111:
112:            /**
113:             *  Gets the NewName attribute of the RenameFieldData object
114:             *
115:             *@return    The NewName value
116:             */
117:            public String getNewName() {
118:                return newName;
119:            }
120:
121:            /**
122:             *  Gets the ThisRequired attribute of the RenameFieldData object
123:             *
124:             *@return    The ThisRequired value
125:             */
126:            public boolean isThisRequired() {
127:                return this Required;
128:            }
129:
130:            /**
131:             *  Gets the CurrentSummary attribute of the RenameFieldData object
132:             *
133:             *@return    The CurrentSummary value
134:             */
135:            public Summary getCurrentSummary() {
136:                return current;
137:            }
138:
139:            /**
140:             *  Gets the MustInsertThis attribute of the RenameFieldData object
141:             *
142:             *@return    The MustInsertThis value
143:             */
144:            public boolean isMustInsertThis() {
145:                return mustInsertThis;
146:            }
147:
148:            /**
149:             *  Returns the type summary where the field is changing
150:             *
151:             *@return    The TypeSummary value
152:             */
153:            public TypeSummary getTypeSummary() {
154:                return typeSummary;
155:            }
156:
157:            /**
158:             *  Gets the AllowedToChangeFirst attribute of the RenameFieldData object
159:             *
160:             *@return    The AllowedToChangeFirst value
161:             */
162:            public boolean isAllowedToChangeFirst() {
163:                return canBeFirst;
164:            }
165:
166:            /**
167:             *  Gets the AllowedToChangeThis attribute of the RenameFieldData object
168:             *
169:             *@return    The AllowedToChangeThis value
170:             */
171:            public boolean isAllowedToChangeThis() {
172:                return canBeThis;
173:            }
174:
175:            /**
176:             *  Gets the OldField attribute of the RenameFieldData object
177:             *
178:             *@return    The OldField value
179:             */
180:            public MethodSummary getOldMethod() {
181:                return oldMethod;
182:            }
183:
184:            /**
185:             *  Gets the ComplexTransform attribute of the RenameFieldData object
186:             *
187:             *@return    The ComplexTransform value
188:             */
189:            public ComplexTransform getComplexTransform() {
190:                return transform;
191:            }
192:
193:            /**
194:             *  Gets the FullName attribute of the RenameFieldData object
195:             *
196:             *@return    The FullName value
197:             */
198:            public String getFullName() {
199:                return fullName;
200:            }
201:
202:            /**
203:             *  Gets the ImportedName attribute of the RenameFieldData object
204:             *
205:             *@return    The ImportedName value
206:             */
207:            public String getImportedName() {
208:                return importedName;
209:            }
210:
211:            /**
212:             *  Returns true if the system can change the first name in an array
213:             *
214:             *@param  current  the type summary in question
215:             */
216:            private void check(TypeSummary current) {
217:                if ((current == typeSummary)
218:                        || Ancestor.query(current, typeSummary)) {
219:                    canBeFirst = true;
220:                    canBeThis = true;
221:                    return;
222:                }
223:
224:                Summary cs = current;
225:                while (cs != null) {
226:                    if (cs == typeSummary) {
227:                        canBeThis = false;
228:                        canBeFirst = true;
229:                        return;
230:                    }
231:
232:                    cs = cs.getParent();
233:                }
234:
235:                canBeThis = false;
236:                canBeFirst = false;
237:            }
238:
239:            /**
240:             *  Initialize the names
241:             *
242:             *@param  field  the field summary
243:             */
244:            private void initNames(MethodSummary method) {
245:                StringBuffer buffer = new StringBuffer(method.getName());
246:
247:                Summary current = method;
248:                while (current != null) {
249:                    if (current instanceof  TypeSummary) {
250:                        buffer.insert(0, ".");
251:                        buffer.insert(0, current.getName());
252:                    }
253:
254:                    if (current instanceof  PackageSummary) {
255:                        importedName = buffer.toString();
256:                        buffer.insert(0, ".");
257:                        buffer.insert(0, current.getName());
258:                        fullName = buffer.toString();
259:                        return;
260:                    }
261:
262:                    current = current.getParent();
263:                }
264:
265:                //  We should never get here
266:                importedName = buffer.toString();
267:                fullName = buffer.toString();
268:            }
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.