01: package com.jamonapi;
02:
03: /**
04:
05: * Base class for FrequencyDists
06:
07: */
08:
09: import java.text.*;
10:
11: import com.jamonapi.utils.*;
12:
13: final class FrequencyDistBase extends FrequencyDistImp {
14:
15: /** Creates a new instance of FrequencyDistBase */
16:
17: public FrequencyDistBase(String displayHeader, double endValue,
18: String name) {
19: this .monData.displayHeader = displayHeader;
20: this .endValue = endValue;
21: this .monData.name = name;
22:
23: }
24:
25: private String format(double value) {
26:
27: DecimalFormat decimalFormat = LocaleContext
28: .getFloatingPointFormatter();
29: return decimalFormat.format(value);
30:
31: }
32:
33: public String toString() {
34:
35: if (!isEnabled() || monData.hits == 0)
36: return "";
37: else {
38: StringBuffer buff = new StringBuffer();
39: buff.append(format(getHits()));
40: buff.append("/");
41: buff.append(format(getAvg()));
42: buff.append(" (");
43: buff.append(format(getAvgActive())).append("/");
44: buff.append(format(getAvgPrimaryActive())).append("/");
45: buff.append(format(getAvgGlobalActive())).append(")");
46: return buff.toString();
47:
48: }
49:
50: }
51:
52: }
|