01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.metrics;
10:
11: import org.acm.seguin.summary.PackageSummary;
12: import java.text.NumberFormat;
13:
14: /**
15: * Package metrics frame
16: *
17: *@author Chris Seguin
18: *@created July 26, 1999
19: */
20: public class PackageMetricsFrame extends MetricsFrame {
21: // Instance Variables
22: private PackageSummary summary;
23: private PackageMetrics metrics;
24:
25: /**
26: * Constructor for the PackageMetricsFrame object
27: *
28: *@param initPackage Description of Parameter
29: */
30: public PackageMetricsFrame(PackageSummary initPackage) {
31: summary = initPackage;
32: ProjectMetrics temp = new ProjectMetrics();
33: GatherData data = new GatherData(null);
34: metrics = (PackageMetrics) data.visit(summary, temp);
35:
36: descriptions = new String[] { "Description", "Statement Total",
37: "Statement Average", "Parameter Total",
38: "Parameter Average", "Public Method Total",
39: "Public Method Average", "Other Method Total",
40: "Other Method Average", "Class Method Total",
41: "Class Method Average", "Instance Variable Total",
42: "Instance Variable Average", "Class Variable Total",
43: "Class Variable Average", "Total Classes",
44: "Abstract Class Count", "Percent Abstract Classes",
45: "Interface Count", "Percent Interfaces" };
46:
47: // Fill in the value array
48: values = new String[20];
49: NumberFormat nf = NumberFormat.getInstance();
50: nf.setMaximumFractionDigits(2);
51: values[0] = "Values";
52: values[1] = nf.format(metrics.getStatementTotal());
53: values[2] = nf.format(metrics.getStatementAverage());
54: values[3] = nf.format(metrics.getParameterTotal());
55: values[4] = nf.format(metrics.getParameterAverage());
56: values[5] = nf.format(metrics.getPublicMethodTotal());
57: values[6] = nf.format(metrics.getPublicMethodAverage());
58: values[7] = nf.format(metrics.getOtherMethodTotal());
59: values[8] = nf.format(metrics.getOtherMethodAverage());
60: values[9] = nf.format(metrics.getClassMethodTotal());
61: values[10] = nf.format(metrics.getClassMethodAverage());
62: values[11] = nf.format(metrics.getInstanceVariableTotal());
63: values[12] = nf.format(metrics.getInstanceVariableAverage());
64: values[13] = nf.format(metrics.getClassVariableTotal());
65: values[14] = nf.format(metrics.getClassVariableAverage());
66: values[15] = nf.format(metrics.getClassTotal());
67: values[16] = nf.format(metrics.getAbstractClassCount());
68: values[17] = nf.format(metrics.getAbstractClassPercentage())
69: + " %";
70: values[18] = nf.format(metrics.getInterfaceCount());
71: values[19] = nf.format(metrics.getInterfacePercentage()) + " %";
72:
73: // Create the frame
74: createFrame();
75: }
76:
77: /**
78: * Returns the title of this frame
79: *
80: *@return Description of the Returned Value
81: */
82: protected String getTitle() {
83: return "Metrics for the package " + summary.getName();
84: }
85: }
|