Source Code Cross Referenced for MethodSetsElement.java in  » Code-Analyzer » JBlanket » csdl » jblanket » report » element » 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 » JBlanket » csdl.jblanket.report.element 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package csdl.jblanket.report.element;
002:
003:        import java.io.PrintWriter;
004:        import java.util.Iterator;
005:        import java.util.Map;
006:        import java.util.TreeMap;
007:
008:        /**
009:         * Provides a wrapper for the 'MethodSets' element in the aggregate XML file.  An instance of a
010:         * MethodSetsElement represents elements in a MethodSets.
011:         * <p>
012:         * An example of a 'MethodSets' as a MethodSetsElement with no 'MethodSet's:
013:         * <pre>
014:         *   &lt;MethodSets tested="0" untested="0" oneline="0" constructor="0" timestamp=""/&gt; 
015:         * </pre>
016:         * <p>
017:         * An example of a 'MethodSets' as a MethodSetsElement with 'MethodSet's:
018:         * <pre>
019:         *   &lt;MethodSets tested="1" untested="0" oneline="0"&gt;
020:         *     &lt;MethodSet class="String" package="java.lang" tested="1" untested="0" oneline="0" 
021:         *                constructor="0" timestamp=""&gt;
022:         *       &lt;tested&gt;
023:         *         &lt;Method name="indexOf" package="java.lang.String"&gt;
024:         *           &lt;Parameter type="java.lang.String"/&gt;
025:         *           &lt;Parameter type="int"/&gt;
026:         *         &lt;/Method&gt;
027:         *       &lt;/tested&gt;
028:         *       &lt;untested/&gt;
029:         *       &lt;oneline/&gt;
030:         *       &lt;constructor/&gt;
031:         *     &lt;/MethodSet&gt;
032:         *   &lt;/MethodSets&gt; 
033:         * </pre>
034:         * 
035:         * @author Joy M. Agustin
036:         * @version $Id: MethodSetsElement.java,v 1.1 2004/11/07 00:32:39 timshadel Exp $
037:         */
038:        public class MethodSetsElement {
039:
040:            /** Contains all MethodSet elements; maps className -> MethodSetElement */
041:            private Map methodSetMap;
042:
043:            /**
044:             * Constructs a new MethodSetsElement object.
045:             */
046:            public MethodSetsElement() {
047:                this .methodSetMap = new TreeMap();
048:            }
049:
050:            /**
051:             * Puts a MethodSetElement object into this MethodSetsElement object.
052:             * 
053:             * @param className the name of the class of <code>methodSet</code>.
054:             * @param methodSet the MethodSetElement to store.
055:             */
056:            public void put(String className, MethodSetElement methodSet) {
057:                this .methodSetMap.put(className, methodSet);
058:            }
059:
060:            /**
061:             * Gets the MethodSetElement associated with <code>className</code>.
062:             * 
063:             * @param className the name of the class who's MethodSetElement to retrieve.
064:             * @return the MethodSetElement for <code>className</code>.
065:             */
066:            public Object get(String className) {
067:                return this .methodSetMap.get(className);
068:            }
069:
070:            /**
071:             * Returns a String representation of this MethodSetsElement as found in an aggregate XML file.
072:             * 
073:             * @return a String representation of this MethodSetsElement.
074:             */
075:            public String toString() {
076:
077:                int tested = 0;
078:                int untested = 0;
079:                int oneline = 0;
080:                int constructor = 0;
081:
082:                for (Iterator i = this .methodSetMap.values().iterator(); i
083:                        .hasNext();) {
084:                    MethodSetElement methodSet = (MethodSetElement) i.next();
085:                    tested += methodSet.getTestedSize();
086:                    untested += methodSet.getUntestedSize();
087:                    oneline += methodSet.getOnelineSize();
088:                    constructor += methodSet.getConstructorSize();
089:                }
090:
091:                StringBuffer buffer = new StringBuffer();
092:                buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
093:                buffer.append("<MethodSets tested=\"" + tested + "\"");
094:                buffer.append(" untested=\"" + untested + "\"");
095:                buffer.append(" oneline=\"" + oneline + "\"");
096:                buffer.append(" constructor=\"" + constructor + "\">\n");
097:                for (Iterator i = this .methodSetMap.values().iterator(); i
098:                        .hasNext();) {
099:                    buffer.append((MethodSetElement) i.next());
100:                    buffer.append("\n");
101:                }
102:                buffer.append("</MethodSets>");
103:
104:                return buffer.toString();
105:            }
106:
107:            /**
108:             * Writes this MethodSetsElement to writer.
109:             * 
110:             * @param writer points to an output file.
111:             */
112:            public void write(PrintWriter writer) {
113:
114:                int tested = 0;
115:                int untested = 0;
116:                int oneline = 0;
117:                int constructor = 0;
118:
119:                for (Iterator i = this .methodSetMap.values().iterator(); i
120:                        .hasNext();) {
121:                    MethodSetElement methodSet = (MethodSetElement) i.next();
122:                    tested += methodSet.getTestedSize();
123:                    untested += methodSet.getUntestedSize();
124:                    oneline += methodSet.getOnelineSize();
125:                    constructor += methodSet.getConstructorSize();
126:                }
127:
128:                writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
129:                writer.write("<MethodSets tested=\"" + tested + "\"");
130:                writer.write(" untested=\"" + untested + "\"");
131:                writer.write(" oneline=\"" + oneline + "\"");
132:                writer.write(" constructor=\"" + constructor + "\">\n");
133:                for (Iterator i = this .methodSetMap.values().iterator(); i
134:                        .hasNext();) {
135:                    ((MethodSetElement) i.next()).write(writer);
136:                    writer.write("\n");
137:                }
138:                writer.write("</MethodSets>");
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.