001: package com.jamonapi;
002:
003: /**
004: * RangeImpInt.java
005: *
006: * Created on January 10, 2006, 11:26 AM
007: */
008:
009: /**
010: * Due to the fact that setting ranges would cause knowledge of the ActivityStats I opted
011: * not to expose setRange at this point.
012: * RangeImpInt stands for Range Implementation Interface. This interface has some interface
013: * details I don't want to expose. Range is the public interface that developers can access.
014: */
015: import java.util.List;
016:
017: abstract class RangeImp implements Range, RowData, JAMonListener {
018: protected FrequencyDistImp[] frequencyDist;
019: protected RangeHolder rangeHolder;
020: protected boolean isLessThan = false;
021:
022: abstract protected RangeImp copy(ActivityStats activityStats);
023:
024: public String getFreqDistName(int count) {
025: return "Range" + count + "_";
026: }
027:
028: public int getFreqDistSize() {
029: return (frequencyDist == null) ? 0 : frequencyDist.length;
030: }
031:
032: public FrequencyDist[] getFrequencyDists() {
033: return frequencyDist;
034: }
035:
036: public String getLastHeader() {
037: return (rangeHolder == null) ? "LastRange" : rangeHolder
038: .getLastHeader();
039: }
040:
041: public List getBasicHeader(List header) {
042: // this isn't called but still will return no changes (ranges don't
043: // participate in basic headers)
044: return header;
045: }
046:
047: public List getDisplayHeader(List header) {
048: int size = getFreqDistSize();
049:
050: for (int i = 0; i < size; i++) {
051: frequencyDist[i].getDisplayHeader(header);
052: }
053:
054: return header;
055:
056: }
057:
058: public List getHeader(List header) {
059: int size = getFreqDistSize();
060:
061: for (int i = 0; i < size; i++) {
062: frequencyDist[i].getHeader(header);
063: }
064:
065: return header;
066: }
067:
068: public List getBasicRowData(List rowData) {
069: // basic row data does not include ranges so simply return. note the monitors don't
070: // even call this method to save the step.
071: return rowData;
072: }
073:
074: public List getRowData(List rowData) {
075: int size = getFreqDistSize();
076:
077: for (int i = 0; i < size; i++) {
078: frequencyDist[i].getRowData(rowData);
079: }
080:
081: return rowData;
082:
083: }
084:
085: public List getRowDisplayData(List rowData) {
086: int size = getFreqDistSize();
087: for (int i = 0; i < size; i++) {
088: frequencyDist[i].getRowDisplayData(rowData);
089: }
090:
091: return rowData;
092:
093: }
094:
095: public RangeHolder getRangeHolder() {
096: return rangeHolder;
097: }
098:
099: public String getLogicalOperator() {
100: return (isLessThan) ? "<" : "<=";
101:
102: }
103:
104: public void setActivityTracking(boolean trackActivity) {
105: int size = getFreqDistSize();
106: for (int i = 0; i < size; i++) {
107: frequencyDist[i].setActivityTracking(trackActivity);
108: }
109: }
110:
111: }
|