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 java.text.NumberFormat;
12:
13: /**
14: * Project metrics frame
15: *
16: *@author Chris Seguin
17: *@created July 26, 1999
18: */
19: public class ProjectMetricsFrame extends MetricsFrame {
20: // Instance Variables
21: private ProjectMetrics metrics;
22:
23: /**
24: * Constructor for the ProjectMetricsFrame object
25: */
26: public ProjectMetricsFrame() {
27: GatherData data = new GatherData(null);
28: metrics = (ProjectMetrics) data.visit("");
29:
30: descriptions = new String[] { "Description", "Statement Total",
31: "Statement Average", "Parameter Total",
32: "Parameter Average", "Public Method Total",
33: "Public Method Average", "Other Method Total",
34: "Other Method Average", "Class Method Total",
35: "Class Method Average", "Instance Variable Total",
36: "Instance Variable Average", "Class Variable Total",
37: "Class Variable Average", "Total Classes",
38: "Abstract Class Total", "Percent Abstract Classes",
39: "Interface Total", "Percent Interfaces" };
40:
41: // Fill in the value array
42: values = new String[20];
43: values[0] = "Values";
44:
45: NumberFormat nf = NumberFormat.getInstance();
46: nf.setMaximumFractionDigits(2);
47:
48: values[1] = nf.format(metrics.getStatementTotal());
49: values[2] = nf.format(metrics.getStatementAverage());
50: values[3] = nf.format(metrics.getParameterTotal());
51: values[4] = nf.format(metrics.getParameterAverage());
52: values[5] = nf.format(metrics.getPublicMethodTotal());
53: values[6] = nf.format(metrics.getPublicMethodAverage());
54: values[7] = nf.format(metrics.getOtherMethodTotal());
55: values[8] = nf.format(metrics.getOtherMethodAverage());
56: values[9] = nf.format(metrics.getClassMethodTotal());
57: values[10] = nf.format(metrics.getClassMethodAverage());
58: values[11] = nf.format(metrics.getInstanceVariableTotal());
59: values[12] = nf.format(metrics.getInstanceVariableAverage());
60: values[13] = nf.format(metrics.getClassVariableTotal());
61: values[14] = nf.format(metrics.getClassVariableAverage());
62: values[15] = nf.format(metrics.getClassTotal());
63: values[16] = nf.format(metrics.getAbstractClassTotal());
64: values[17] = nf.format(metrics.getAbstractClassPercentage())
65: + " %";
66: values[18] = nf.format(metrics.getInterfaceTotal());
67: values[19] = nf.format(metrics.getInterfacePercentage()) + " %";
68:
69: // Create the frame
70: createFrame();
71: }
72:
73: /**
74: * Returns the title of this frame
75: *
76: *@return Description of the Returned Value
77: */
78: protected String getTitle() {
79: return "Metrics for the project";
80: }
81: }
|