diff --git a/.classpath b/.classpath
index c4a5e07..3875dff 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,9 @@
+
+The number of packages that depend upon the classes within the analyzed +package. +
++The number of packages that the classes in the analyzed package depend upon. +
++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. +
++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. +
++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 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. +
+ diff --git a/res/main.css b/res/main.css new file mode 100644 index 0000000..772e009 --- /dev/null +++ b/res/main.css @@ -0,0 +1,62 @@ +body { + background-color: #eeeeee; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 10pt; +} + +h1 { + font-size: 24pt; + color: #023264; + font-family: Arial; + font-weight: bold; + font-family: Arial +} + +h2 { + color: white; + background-color: #023264; +} + +h3 { + font-size: 14pt; + color: #023264; +} + +#hor-minimalist-b { + font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; + font-size: 12px; + margin: 45px; + width: 80%; + border-collapse: collapse; + text-align: left; +} + +#hor-minimalist-b th { + font-size: 14px; + font-weight: normal; + color: #039; + padding: 10px 8px; + border-bottom: 2px solid #6678b1; +} + +#hor-minimalist-b td { + border-bottom: 1px solid #ccc; + color: #669; + padding: 6px 8px; +} + +#hor-minimalist-b tbody tr:hover td { + color: #009; +} + +.message { + color: #aaaaaa; + font-size: 0.8em; +} + +.footer { + color: #aaaaaa; + font-size: 0.8em; + text-align: center; + margin-top: 3em; +} \ No newline at end of file diff --git a/src/jdepend/framework/AbstractParser.java b/src/jdepend/framework/AbstractParser.java index 17849d4..f621fd6 100755 --- a/src/jdepend/framework/AbstractParser.java +++ b/src/jdepend/framework/AbstractParser.java @@ -16,8 +16,7 @@ public abstract class AbstractParser { private ArrayList parseListeners; private PackageFilter filter; - public static boolean DEBUG = false; - + public static final boolean DEBUG = Boolean.parseBoolean( System.getProperty( "jdepend.debug", "false" ) ); public AbstractParser() { this(new PackageFilter()); diff --git a/src/jdepend/framework/ClassFileParser.java b/src/jdepend/framework/ClassFileParser.java index 93af36f..13b14a8 100755 --- a/src/jdepend/framework/ClassFileParser.java +++ b/src/jdepend/framework/ClassFileParser.java @@ -745,8 +745,6 @@ public String toString() { public static void main(String args[]) { try { - ClassFileParser.DEBUG = true; - if (args.length <= 0) { System.err.println("usage: ClassFileParserJDepend class analyzes directories of Java class files, generates metrics for each Java package, and
+ * reports the metrics in a HTML format.
+ *
+ * @author Richard Oliver Legendi (rlegendi)
+ */
+public class JDepend
+ extends jdepend.textui.JDepend {
+
+ /**
+ * Constructs a JDepend instance using standard output.
+ */
+ public JDepend() {
+ this( new PrintWriter( System.out ) );
+ }
+
+ /**
+ * Constructs a JDepend instance with the specified writer.
+ *
+ * @param writer Writer.
+ */
+ public JDepend(final PrintWriter writer) {
+ super( writer );
+
+ formatter = NumberFormat.getInstance( Locale.ENGLISH );
+ formatter.setMaximumFractionDigits( 2 );
+ }
+
+ // TODO This definitely needs some update. If there're more source folders (e.g. src, test), it may
+ // be impossible to locate them correctly.
+ private String findJavaClassLocation(final JavaClass javaClass) {
+ return "src" + File.separatorChar + javaClass.getName().replace( '.', File.separatorChar );
+ }
+
+ /**
+ * Includes a file to the current PrintWriter object.
+ *
+ *
+ * File allocation is performed through the {@link Class#getResourceAsStream(String)} function, using the
+ * '/' prefix helps navigation with an absolute name of the referred resource.
+ *
Designed to use with JDepend and Ant.
" ); + getWriter().println( "Report generated at " + new Date() ); + + getWriter().println( "
| Name | " ); + getWriter().println( tab( 2 ) + "Class Count | " ); + getWriter().println( tab( 2 ) + "Abstract Class Count | " ); + getWriter().println( tab( 2 ) + "Ca | " ); + getWriter().println( tab( 2 ) + "Ce | " ); + getWriter().println( tab( 2 ) + "A | " ); + getWriter().println( tab( 2 ) + "I | " ); + getWriter().println( tab( 2 ) + "D | " ); + getWriter().println( tab( 2 ) + "V | " ); + getWriter().println( tab( 1 ) + "
|---|---|---|---|---|---|---|---|---|
| " + jPackage.getName() + " | " ); + getWriter().println( tab( 2 ) + "" + jPackage.getClassCount() + " | " ); + getWriter().println( tab( 2 ) + "" + jPackage.getAbstractClassCount() + " | " ); + getWriter().println( tab( 2 ) + "" + jPackage.afferentCoupling() + " | " ); + getWriter().println( tab( 2 ) + "" + jPackage.efferentCoupling() + " | " ); + getWriter().println( tab( 2 ) + "" + toFormattedString( jPackage.abstractness() ) + " | " ); + getWriter().println( tab( 2 ) + "" + toFormattedString( jPackage.instability() ) + " | " ); + getWriter().println( tab( 2 ) + "" + toFormattedString( jPackage.distance() ) + " | " ); + getWriter().println( tab( 2 ) + "" + jPackage.getVolatility() + " | " ); + getWriter().println( tab( 1 ) + "
instanceMain() method
+ */
+ public static void main(final String args[]) {
+ new JDepend().instanceMain( args );
+ }
+
+}