jdepend.xmlui.JDepend Maven / Gradle / Ivy
package jdepend.xmlui;
import java.io.*;
import java.util.*;
import java.text.NumberFormat;
import jdepend.framework.JavaClass;
import jdepend.framework.JavaPackage;
/**
* The JDepend
class analyzes directories of Java class files,
* generates metrics for each Java package, and reports the metrics in an XML
* format.
*
* @author Mike Clark
* @author Clarkware Consulting, Inc.
*/
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(PrintWriter writer) {
super(writer);
formatter = NumberFormat.getInstance(Locale.ENGLISH);
formatter.setMaximumFractionDigits(2);
}
protected void printHeader() {
getWriter().println("");
getWriter().println("");
}
protected void printFooter() {
getWriter().println(" ");
}
protected void printPackagesHeader() {
getWriter().println(tab() + "");
}
protected void printPackagesFooter() {
getWriter().println(tab() + " ");
}
protected void printPackageHeader(JavaPackage jPackage) {
printSectionBreak();
getWriter().println(
tab(2) + "");
}
protected void printPackageFooter(JavaPackage jPackage) {
getWriter().println(tab(2) + " ");
}
protected void printNoStats() {
getWriter().println(
tab(3) + "No stats available: "
+ "package referenced, but not analyzed. ");
}
protected void printStatistics(JavaPackage jPackage) {
getWriter().println(tab(3) + "");
getWriter().println(
tab(4) + "" + jPackage.getClassCount()
+ " ");
getWriter().println(
tab(4) + "" + jPackage.getConcreteClassCount()
+ " ");
getWriter().println(
tab(4) + "" + jPackage.getAbstractClassCount()
+ " ");
getWriter().println(
tab(4) + "" + jPackage.afferentCoupling() + " ");
getWriter().println(
tab(4) + "" + jPackage.efferentCoupling() + " ");
getWriter().println(
tab(4) + "" + toFormattedString(jPackage.abstractness())
+ "");
getWriter().println(
tab(4) + "" + toFormattedString(jPackage.instability())
+ "");
getWriter().println(
tab(4) + "" + toFormattedString(jPackage.distance())
+ " ");
getWriter().println(tab(4) + "" + jPackage.getVolatility() + " ");
getWriter().println(tab(3) + " ");
}
protected void printClassName(JavaClass jClass) {
getWriter().println(
tab(4) + "");
getWriter().println(tab(5) + jClass.getName());
getWriter().println(tab(4) + " ");
}
protected void printPackageName(JavaPackage jPackage) {
getWriter().println(
tab(4) + "" + jPackage.getName() + " ");
}
protected void printAbstractClassesHeader() {
getWriter().println(tab(3) + "");
}
protected void printAbstractClassesFooter() {
getWriter().println(tab(3) + " ");
}
protected void printConcreteClassesHeader() {
getWriter().println(tab(3) + "");
}
protected void printConcreteClassesFooter() {
getWriter().println(tab(3) + " ");
}
protected void printEfferentsHeader() {
getWriter().println(tab(3) + "");
}
protected void printEfferentsFooter() {
getWriter().println(tab(3) + " ");
}
protected void printEfferentsError() {
// do nothing
}
protected void printAfferentsHeader() {
getWriter().println(tab(3) + "");
}
protected void printAfferentsFooter() {
getWriter().println(tab(3) + " ");
}
protected void printAfferentsError() {
// do nothing
}
protected void printCyclesHeader() {
printSectionBreak();
getWriter().println(tab() + "");
}
protected void printCyclesFooter() {
getWriter().println(tab() + " ");
}
protected void printCycleHeader(JavaPackage jPackage) {
getWriter().println(
tab(2) + "");
}
protected void printCycleFooter() {
getWriter().println(tab(2) + " ");
printSectionBreak();
}
protected void printCycleTarget(JavaPackage jPackage) {
printCycleContributor(jPackage);
}
protected void printCycleContributor(JavaPackage jPackage) {
getWriter().println(
tab(3) + "" + jPackage.getName() + " ");
}
protected void printSummary(Collection packages) {
// do nothing
}
/**
* Main.
*/
public static void main(String args[]) {
new JDepend().instanceMain(args);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy