Source Code Cross Referenced for TracedMethod.java in  » Code-Analyzer » hammurapi-3.20.0.3 » org » hammurapi » inspectors » metrics » callertrace » 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 » Code Analyzer » hammurapi 3.20.0.3 » org.hammurapi.inspectors.metrics.callertrace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Nov 4, 2003
003:         *
004:         * To change the template for this generated file go to
005:         * Window>Preferences>Java>Code Generation>Code and Comments
006:         */
007:        package org.hammurapi.inspectors.metrics.callertrace;
008:
009:        import java.util.Iterator;
010:        import java.util.Set;
011:        import java.util.SortedMap;
012:        import java.util.TreeMap;
013:
014:        import org.w3c.dom.Document;
015:        import org.w3c.dom.Element;
016:
017:        /**
018:         * @author mucbj0
019:         *
020:         * To change the template for this generated type comment go to
021:         * Window>Preferences>Java>Code Generation>Code and Comments
022:         */
023:        public class TracedMethod {
024:            private MethodWrapper method = null;
025:            private SortedMap keyMethodList = new TreeMap(
026:                    new TracedMethodLocComparator());
027:
028:            private String searchKey = "";
029:            private boolean endpoint = false;
030:            private boolean key = false;
031:
032:            public TracedMethod(MethodWrapper mw) {
033:                super ();
034:                method = mw;
035:            }
036:
037:            /**
038:             * @return
039:             */
040:            public MethodWrapper getMethod() {
041:                return method;
042:            }
043:
044:            /**
045:             * @param method
046:             */
047:            public void setMethod(MethodWrapper method) {
048:                this .method = method;
049:            }
050:
051:            public String toString() {
052:
053:                if (method != null) {
054:                    return method.toString();
055:                    // return method.getMethodKey();
056:                } else {
057:                    return searchKey;
058:                }
059:            }
060:
061:            public Element toDom(Document document, int id) {
062:                Element ret = document.createElement("TracedMethod");
063:                ret.setAttribute("id", String.valueOf(id));
064:                Set s = this .getKeyMethodList().keySet();
065:                for (Iterator it = s.iterator(); it.hasNext();) {
066:                    MethodWrapper m = (MethodWrapper) it.next();
067:                    Element ret2 = document.createElement("Inside");
068:                    ret.appendChild(ret2);
069:
070:                    if (this .getMethod().equals(m)) {
071:                        if (this .isKey()) {
072:                            ret2.setAttribute("type", "key");
073:                        } else {
074:                            ret2.setAttribute("type", "mother");
075:                        }
076:                    } else {
077:                        ret2.setAttribute("type", "sibling");
078:                    }
079:                    ;
080:
081:                    if (this .getMethod() != null) {
082:                        Element ret3 = document.createElement("Method");
083:                        ret3.setAttribute("key", m.printMethodName());
084:                        if (m instanceof  MethodWrapperDeclaration) {
085:                            ret3
086:                                    .setAttribute(
087:                                            "Ma",
088:                                            String
089:                                                    .valueOf(((MethodWrapperDeclaration) m).afferentMethodCoupling));
090:                            ret3.setAttribute("Me", String
091:                                    .valueOf(((MethodWrapperDeclaration) m)
092:                                            .getInvokedMethods().size()));
093:                        } else {
094:                            ret3.setAttribute("Ma", "");
095:                            ret3.setAttribute("Me", "");
096:
097:                        }
098:                        ret3.setAttribute("source-url", m.getSrcURL());
099:                        ret3.setAttribute("line", String
100:                                .valueOf(m.getSrcLine()));
101:
102:                        ret2.appendChild(ret3);
103:                    }
104:                }
105:                return ret;
106:            }
107:
108:            public String toXml(int id) {
109:                StringBuffer sb = new StringBuffer();
110:                Set s = this .getKeyMethodList().keySet();
111:                sb.append("<TracedMethod id=\"" + id + "\">");
112:
113:                for (Iterator it = s.iterator(); it.hasNext();) {
114:                    MethodWrapper m = (MethodWrapper) it.next();
115:
116:                    sb.append("<Inside ");
117:
118:                    sb.append("type=\"");
119:                    if (this .getMethod().equals(m)) {
120:                        sb.append("mother");
121:                    } else {
122:                        sb.append("sibling");
123:                    }
124:                    ;
125:                    sb.append("\">\n");
126:                    if (this .getMethod() != null) {
127:                        sb.append(m.getMethodKey());
128:                        sb.append(m.getLine());
129:                        sb.append(m.getSrcURL());
130:                    }
131:                    sb.append("</Inside>\n");
132:                }
133:                sb.append("</TracedMethod>\n");
134:                return sb.toString();
135:            }
136:
137:            /**
138:             * @return
139:             */
140:            public String getSearchKey() {
141:                return searchKey;
142:            }
143:
144:            /**
145:             * @param string
146:             */
147:            public void setSearchKey(String string) {
148:                searchKey = string;
149:            }
150:
151:            /**
152:             * @return
153:             */
154:            public boolean isEndpoint() {
155:
156:                return endpoint;
157:            }
158:
159:            /**
160:             * @return
161:             */
162:            public boolean isKey() {
163:
164:                return key;
165:            }
166:
167:            /**
168:             *
169:             */
170:            public void setIsKeyTrue() {
171:                key = true;
172:
173:            }
174:
175:            /**
176:             *
177:             */
178:            public void setEndpointTrue() {
179:                endpoint = true;
180:
181:            }
182:
183:            public String toKey() {
184:                if (this .method != null) {
185:                    return ((MethodWrapper) this .method).toSearchKey();
186:                } else {
187:                    return getSearchKey();
188:                }
189:            }
190:
191:            /**
192:             * @return Returns the headKeyMethodList.
193:             */
194:            public SortedMap getKeyMethodList() {
195:                return keyMethodList;
196:            }
197:
198:            /**
199:             * @param headKeyMethodList The headKeyMethodList to set.
200:             */
201:            public void setKeyMethodList(SortedMap headKeyMethodList) {
202:                this .keyMethodList = headKeyMethodList;
203:            }
204:
205:            /**
206:             * @param key
207:             * @param this
208:             */
209:            public void innerCheckForSiblings(String[] key) {
210:                if (getMethod() != null) {
211:                    getKeyMethodList().put(getMethod(), getMethod());
212:
213:                    // System.out.println( "++ " + tm.getMethod().getClass().getName() )
214:                    // ;
215:                    //--loockup for implementor of MethodInvoked
216:
217:                    MethodWrapperDeclaration methodImpl = null;
218:                    if (getMethod() instanceof  MethodWrapperInvoked) {
219:                        //-- use original Key!
220:                        methodImpl = ((MethodWrapperInvoked) getMethod())
221:                                .getCallerMethod();
222:                    } else {
223:                        methodImpl = (MethodWrapperDeclaration) getMethod();
224:                    }
225:                    if (methodImpl != null
226:                            && methodImpl.getInvokedMethods() != null) {
227:                        for (Iterator it = methodImpl.getInvokedMethods()
228:                                .iterator(); it.hasNext();) {
229:                            MethodWrapperInvoked method = (MethodWrapperInvoked) it
230:                                    .next();
231:
232:                            for (int j = 0; j < key.length; j++) {
233:                                // System.out.println("method " +
234:                                // method.printMethodName() +" $$ " + key[j]);
235:                                if (method.printMethodName().equals(key[j])) {
236:                                    // System.out.println(" ** " + method.toSearchKey()
237:                                    // + " ** ");
238:                                    getKeyMethodList().put(method, method);
239:                                }
240:                            }
241:                            // System.out.println("tm.getKeyMethodList() " +
242:                            // tm.getKeyMethodList());
243:                        }
244:                    } //-- fi
245:                    //					} //--fi
246:                } //--fi
247:            }
248:
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.