Source Code Cross Referenced for JarImpl.java in  » Code-Analyzer » JarAnalyzer » com » kirkk » analyzer » framework » bcelbundle » 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 » JarAnalyzer » com.kirkk.analyzer.framework.bcelbundle 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.kirkk.analyzer.framework.bcelbundle;
002:
003:        import com.kirkk.analyzer.framework.*;
004:        import java.util.*;
005:        import java.math.BigDecimal;
006:
007:        public class JarImpl implements  Jar {
008:
009:            public List packages = new ArrayList();
010:            private List dependentJars = new ArrayList();
011:            private List incomingDependencies = new ArrayList();
012:            private List cyclicJars = new ArrayList();
013:            private boolean containsCycles = false;
014:            private String jarFileName;
015:
016:            public JarImpl(String jarFileName) {
017:                this .jarFileName = jarFileName;
018:            }
019:
020:            public List getAllContainedPackages() {
021:                return packages;
022:            }
023:
024:            public void addOutgoingDependency(Jar jar) {
025:                if (!this .dependentJars.contains(jar)) {
026:                    this .dependentJars.add(jar);
027:                }
028:
029:                //Test for cyclic dependencies.
030:                if (jar.getOutgoingDependencies().contains(this )) {
031:                    //May need to put a conditional here to make sure we only add a cyclic jar if it hasn't already been added.
032:                    if (!this .cyclicJars.contains(jar)) {
033:                        jar.addCyclicJar(this );
034:                        this .addCyclicJar(jar);
035:                    }
036:                }
037:
038:                //When adding a dependent jar, setup the relationship so a jar knows of it's incoming dependencies too.
039:                if (!jar.getIncomingDependencies().contains(this )) {
040:                    jar.addIncomingDependency(this );
041:                }
042:            }
043:
044:            public void addIncomingDependency(Jar jar) {
045:                this .incomingDependencies.add(jar);
046:            }
047:
048:            public void addCyclicJar(Jar jar) {
049:                if (this .cyclicJars == null) {
050:                    this .cyclicJars = new ArrayList();
051:                }
052:                if (!this .cyclicJars.contains(jar)) {
053:                    this .cyclicJars.add(jar);
054:                }
055:                this .containsCycles = true;
056:            }
057:
058:            public boolean hasCycles() {
059:                return this .containsCycles;
060:            }
061:
062:            public List getCyclicJars() {
063:                return this .cyclicJars;
064:            }
065:
066:            public List getOutgoingDependencies() {
067:                return this .dependentJars;
068:            }
069:
070:            public List getIncomingDependencies() {
071:                return this .incomingDependencies;
072:            }
073:
074:            public List getAllExternallyReferencedPackages() {
075:                Iterator allPackages = this .getAllContainedPackages()
076:                        .iterator();
077:                ArrayList externalImports = new ArrayList();
078:                while (allPackages.hasNext()) {
079:                    JarPackage javaPackage = (JarPackage) allPackages.next();
080:                    Iterator dependencies = javaPackage
081:                            .getImportedPackageNames().iterator();
082:                    while (dependencies.hasNext()) {
083:                        String dependentPackage = (String) dependencies.next();
084:                        if ((this .containsPackage(dependentPackage) == false)
085:                                && (externalImports.contains(dependentPackage) == false)) {
086:                            externalImports.add(dependentPackage);
087:                        }
088:
089:                    }
090:                }
091:                return externalImports;
092:            }
093:
094:            public List getAllUnidentifiableExternallyReferencedPackages() {
095:                Iterator externalPackages = this 
096:                        .getAllExternallyReferencedPackages().iterator();
097:                ArrayList unresolvablePackages = new ArrayList();
098:                while (externalPackages.hasNext()) {
099:                    String packageName = (String) externalPackages.next();
100:                    Iterator dependencies = this .dependentJars.iterator();
101:                    boolean packageFound = false;
102:                    while (dependencies.hasNext()) {
103:                        Jar jar = (Jar) dependencies.next();
104:                        if (jar.containsPackage(packageName)) {
105:                            packageFound = true;
106:                        }
107:                    }
108:                    if ((!packageFound)
109:                            && (!unresolvablePackages.contains(packageName))) {
110:                        unresolvablePackages.add(packageName);
111:                    }
112:                }
113:                return unresolvablePackages;
114:            }
115:
116:            public int getPackageCount() {
117:                return this .packages.size();
118:            }
119:
120:            public String getJarFileName() {
121:                //return this.jarFileName.substring(this.jarFileName.lastIndexOf("\\") + 1,
122:                //													this.jarFileName.length());
123:                //return this.jarFileName.substring(this.jarFileName.lastIndexOf("/") + 1,
124:                //													this.jarFileName.length());
125:                return this .jarFileName.substring(this .jarFileName
126:                        .lastIndexOf(System.getProperty("file.separator")) + 1,
127:                        this .jarFileName.length());
128:            }
129:
130:            public String getFullyQualifiedJarFileName() {
131:                return this .jarFileName;
132:            }
133:
134:            public int getClassCount() {
135:                Iterator p = this .packages.iterator();
136:                int classCount = 0;
137:                while (p.hasNext()) {
138:                    JarPackage pkg = (JarPackage) p.next();
139:                    classCount += pkg.getClassCount();
140:                }
141:
142:                return classCount;
143:            }
144:
145:            public int getAbstractClassCount() {
146:                Iterator p = this .packages.iterator();
147:                int classCount = 0;
148:                while (p.hasNext()) {
149:                    JarPackage pkg = (JarPackage) p.next();
150:                    Iterator classes = pkg.getClasses().iterator();
151:                    while (classes.hasNext()) {
152:                        JarClass jarClass = (JarClass) classes.next();
153:                        if (jarClass.isAbstract() || jarClass.isInterface()) {
154:                            classCount++;
155:                        }
156:                    }
157:                }
158:                return classCount;
159:            }
160:
161:            public void addPackage(JarPackage jarPackage) {
162:                packages.add(jarPackage);
163:            }
164:
165:            public JarPackage getPackage(String s) {
166:                JarPackage jarPackage = new JarPackageImpl(s);
167:                int i = packages.indexOf(jarPackage);
168:                return (JarPackage) packages.get(i);
169:            }
170:
171:            public boolean containsPackage(String s) {
172:                if (packages == null) {
173:                    return false;
174:                }
175:                JarPackage jarPackage = new JarPackageImpl(s);
176:                return packages.contains(jarPackage);
177:            }
178:
179:            public JarMetrics calculateMetrics() {
180:                JarMetrics metrics = new JarMetricsImpl(this);
181:                return metrics;
182:            }
183:
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.