Java Doc for JDepend.java in  » Development » jdepend-2.9 » jdepend » framework » 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 » Development » jdepend 2.9 » jdepend.framework 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jdepend.framework.JDepend

JDepend
public class JDepend (Code)
The JDepend class analyzes directories of Java class files and generates the following metrics for each Java package.

  • Afferent Coupling (Ca)

    The number of packages that depend upon the classes within the analyzed package.

  • Efferent Coupling (Ce)

    The number of packages that the classes in the analyzed package depend upon.

  • Abstractness (A)

    The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package.

    The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package.

  • Instability (I)

    The ratio of efferent coupling (Ce) to total coupling (Ce + Ca) such that I = Ce / (Ce + Ca).

    The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package.

  • Distance from the Main Sequence (D)

    The perpendicular distance of a package from the idealized line A + I = 1. A package coincident with the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0).

    The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible.

  • Package Dependency Cycle

    Package dependency cycles are reported along with the paths of packages participating in package dependency cycles.

These metrics are hereafter referred to as the "Martin Metrics", as they are credited to Robert Martin (Object Mentor Inc.) and referenced in the book "Designing Object Oriented C++ Applications using the Booch Method", by Robert C. Martin, Prentice Hall, 1995.

Example API use:

 JDepend jdepend = new JDepend();
 jdepend.addDirectory("/path/to/classes");
 Collection packages = jdepend.analyze();
 Iterator i = packages.iterator();
 while (i.hasNext()) {
 JavaPackage jPackage = (JavaPackage) i.next();
 String name = jPackage.getName();
 int Ca = jPackage.afferentCoupling();
 int Ce = jPackage.efferentCoupling();
 float A = jPackage.abstractness();
 float I = jPackage.instability();
 float D = jPackage.distance();
 boolean b = jPackage.containsCycle();
 }
 

This class is the data model used by the jdepend.textui.JDepend and jdepend.swingui.JDepend views.


author:
   Mike Clark
author:
   Clarkware Consulting, Inc.



Constructor Summary
public  JDepend()
    
public  JDepend(PackageFilter filter)
    

Method Summary
public  voidaddDirectory(String name)
     Adds the specified directory name to the collection of directories to be analyzed.
public  JavaPackageaddPackage(String name)
     Adds the specified Java package name to the collection of analyzed packages.
Parameters:
  name - Java package name.
public  voidaddPackage(JavaPackage pkg)
     Adds the specified Java package to the collection of analyzed packages.
public  voidaddPackages(Collection packages)
     Adds the specified collection of packages to the collection of analyzed packages.
public  voidaddParseListener(ParserListener listener)
     Registers the specified parser listener.
public  Collectionanalyze()
     Analyzes the registered directories and returns the collection of analyzed packages.
public  voidanalyzeInnerClasses(boolean b)
     Determines whether inner classes are analyzed.
public  booleancontainsCycles()
     Indicates whether the packages contain one or more dependency cycles.
public  intcountClasses()
     Returns the number of registered Java classes to be analyzed.
public  intcountPackages()
     Returns the number of analyzed Java packages.
public  booleandependencyMatch(DependencyConstraint constraint)
     Indicates whether the analyzed packages match the specified dependency constraint.
public  PackageFiltergetFilter()
    
public  JavaPackagegetPackage(String name)
     Returns the analyzed package of the specified name.
Parameters:
  name - Package name.
public  CollectiongetPackages()
     Returns the collection of analyzed packages.
public  voidsetComponents(String components)
     Sets the list of components.
public  voidsetFilter(PackageFilter filter)
    


Constructor Detail
JDepend
public JDepend()(Code)



JDepend
public JDepend(PackageFilter filter)(Code)




Method Detail
addDirectory
public void addDirectory(String name) throws IOException(Code)
Adds the specified directory name to the collection of directories to be analyzed.
Parameters:
  name - Directory name.
throws:
  IOException - If the directory is invalid.



addPackage
public JavaPackage addPackage(String name)(Code)
Adds the specified Java package name to the collection of analyzed packages.
Parameters:
  name - Java package name. Added Java package.



addPackage
public void addPackage(JavaPackage pkg)(Code)
Adds the specified Java package to the collection of analyzed packages.
Parameters:
  pkg - Java package.



addPackages
public void addPackages(Collection packages)(Code)
Adds the specified collection of packages to the collection of analyzed packages.
Parameters:
  packages - Collection of packages.



addParseListener
public void addParseListener(ParserListener listener)(Code)
Registers the specified parser listener.
Parameters:
  listener - Parser listener.



analyze
public Collection analyze()(Code)
Analyzes the registered directories and returns the collection of analyzed packages. Collection of analyzed packages.



analyzeInnerClasses
public void analyzeInnerClasses(boolean b)(Code)
Determines whether inner classes are analyzed.
Parameters:
  b - true to analyze inner classes; false otherwise.



containsCycles
public boolean containsCycles()(Code)
Indicates whether the packages contain one or more dependency cycles. true if one or more dependency cycles exist.



countClasses
public int countClasses()(Code)
Returns the number of registered Java classes to be analyzed. Number of classes.



countPackages
public int countPackages()(Code)
Returns the number of analyzed Java packages. Number of Java packages.



dependencyMatch
public boolean dependencyMatch(DependencyConstraint constraint)(Code)
Indicates whether the analyzed packages match the specified dependency constraint. true if the packages match the dependencyconstraint



getFilter
public PackageFilter getFilter()(Code)



getPackage
public JavaPackage getPackage(String name)(Code)
Returns the analyzed package of the specified name.
Parameters:
  name - Package name. Package, or null if the package was not analyzed.



getPackages
public Collection getPackages()(Code)
Returns the collection of analyzed packages. Collection of analyzed packages.



setComponents
public void setComponents(String components)(Code)
Sets the list of components.
Parameters:
  components - Comma-separated list of components.



setFilter
public void setFilter(PackageFilter filter)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.