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.TypeSummary;
12:
13: import java.text.NumberFormat;
14:
15: /**
16: * Type metrics frame
17: *
18: *@author Chris Seguin
19: *@created July 26, 1999
20: */
21: public class TypeMetricsFrame extends MetricsFrame {
22: // Instance Variables
23: private TypeSummary type;
24: private TypeMetrics metrics;
25:
26: /**
27: * Constructor for the TypeMetricsFrame object
28: *
29: *@param initType Description of Parameter
30: */
31: public TypeMetricsFrame(TypeSummary initType) {
32: type = initType;
33: PackageMetrics temp = new PackageMetrics("-package-");
34: GatherData data = new GatherData(null);
35: metrics = (TypeMetrics) data.visit(type, temp);
36:
37: // Fill in the description array
38: descriptions = new String[] { "Description", "Statement Total",
39: "Statement Average", "Parameter Total",
40: "Parameter Average", "Public Method Count",
41: "Other Method Count", "Class Metric Count",
42: "Instance Variable Count", "Class Variable Count" };
43:
44: // Fill in the value array
45: NumberFormat nf = NumberFormat.getInstance();
46: nf.setMaximumFractionDigits(2);
47:
48: values = new String[10];
49: values[0] = "Value";
50: values[1] = nf.format(metrics.getStatementTotal());
51: values[2] = nf.format(metrics.getStatementAverage());
52: values[3] = nf.format(metrics.getParameterTotal());
53: values[4] = nf.format(metrics.getParameterAverage());
54: values[5] = nf.format(metrics.getPublicMethodCount());
55: values[6] = nf.format(metrics.getOtherMethodCount());
56: values[7] = nf.format(metrics.getClassMethodCount());
57: values[8] = nf.format(metrics.getInstanceVariableCount());
58: values[9] = nf.format(metrics.getClassVariableCount());
59:
60: // Create the frame
61: createFrame();
62: }
63:
64: /**
65: * Returns the title of this frame
66: *
67: *@return Description of the Returned Value
68: */
69: protected String getTitle() {
70: return "Metrics for the class " + type.getName();
71: }
72: }
|