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.MethodSummary;
12:
13: import java.text.NumberFormat;
14:
15: /**
16: * Base class for metrics frame
17: *
18: *@author Chris Seguin
19: *@created July 26, 1999
20: */
21: public class MethodMetricsFrame extends MetricsFrame {
22: // Instance Variables
23: private MethodSummary method;
24: private MethodMetrics metrics;
25:
26: /**
27: * Constructor for the MethodMetricsFrame object
28: *
29: *@param initMethod Description of Parameter
30: */
31: public MethodMetricsFrame(MethodSummary initMethod) {
32: method = initMethod;
33: TypeMetrics temp = new TypeMetrics("-package-", "-type-");
34: GatherData data = new GatherData(null);
35: metrics = (MethodMetrics) data.visit(method, temp);
36:
37: descriptions = new String[] { "Description", "Statement Count",
38: "Parameter Count" };
39: values = new String[3];
40:
41: NumberFormat nf = NumberFormat.getInstance();
42: nf.setMaximumFractionDigits(2);
43: values[0] = "Values";
44: values[1] = "" + nf.format(metrics.getStatementCount());
45: values[2] = "" + nf.format(metrics.getParameterCount());
46:
47: createFrame();
48: }
49:
50: /**
51: * Returns the title of this frame
52: *
53: *@return Description of the Returned Value
54: */
55: protected String getTitle() {
56: return "Metrics for the method " + method.getName();
57: }
58: }
|