Java Reference
In-Depth Information
5.
Interval lInterval
6.
mSelectedContinuousStatistics.getIntervals()[iRowIndex];
7.
switch (iColumnIndex) {
8.
case 0:
9.
return intervalToString(lInterval);
10.
case 1:
11.
return new Long(
12.
mSelectedContinuousStatistics.getFrequency(
13.
lInterval));
14.
case 2:
15.
return new Double(
16.
mSelectedContinuousStatistics.getSum(
17.
lInterval));
18.
case 3:
19.
return new Double(
20.
mSelectedContinuousStatistics.getSumOfSquares(
21.
lInterval));
22.
}
23.
return null;
24.
}
The code for intervalToString is shown below. It uses the closure
type to produce a readable representation of the interval.
1. private static String intervalToString(Interval iInterval) {
2.
String lStart "";
3.
String lEnd "";
4.
String lString;
5.
if (iInterval.getIntervalClosure().
6.
equals(IntervalClosure.closedClosed)) {
7.
lStart "[";
8.
lEnd "]";
9.
} else if (iInterval.getIntervalClosure().
10.
equals(IntervalClosure.closedOpen)) {
11.
lStart "[";
12.
lEnd "[";
13.
} else if (iInterval.getIntervalClosure().
14.
equals(IntervalClosure.openClosed)) {
15.
lStart "]";
16.
lEnd "]";
17.
} else if (iInterval.getIntervalClosure().
18.
equals(IntervalClosure.openOpen)) {
19.
lStart "]";
20.
lEnd "[";
21.
}
22.
lString lStart String.valueOf(
23.
iInterval.getStartPoint()) " ; "
24.
String.valueOf(iInterval.getEndPoint()) lEnd;
25.
return lString;
26.}
Search WWH ::




Custom Search