Java Reference
In-Depth Information
are retrieved and stored in the associated member variables. The
DME will not produce statistics if the attribute type is not compatible, hence
the result will be NULL. The code updating the Swing
TableModels
used to show the collected information is contained in
updateDis-
creteStatistics
and
updateNumericalStatistics
that will be detailed later
in the chapter.
The following code shows how the tool example obtains this
information on distributions of numerical attributes.
1. private void updateNumericalStatistics() {
2.
((AbstractTableModel) mNumericalQuantileTable.getModel()).
3.
fireTableDataChanged();
if (mSelectedNumericalStatistics
null) {
4.
5.
mNumericalMinLabel.setText("");
6.
mNumericalMaxLabel.setText("");
7.
mNumericalMeanLabel.setText("");
8.
mNumericalMedianLabel.setText("");
9.
mNumericalStandardDeviationLabel.setText("");
10.
mNumericalVarianceLabel.setText("");
11.
mNumericalInterQuartileRangeLabel.setText("");
12.
return;
13.
}
NumberFormat lFormat
NumberFormat.getNumberInstance();
14.
15.
lFormat.setGroupingUsed(false);
double lMinValue
mSelectedNumericalStatistics.getMinimumValue();
16.
17.
mNumericalMinLabel.setText(lFormat.format(lMinValue));
double lMaxValue
mSelectedNumericalStatistics.getMaximumValue();
18.
19.
mNumericalMaxLabel.setText(lFormat.format(lMaxValue));
double lMeanValue
mSelectedNumericalStatistics.getMeanValue();
20.
21.
mNumericalMeanLabel.setText(lFormat.format(lMeanValue));
double lMedianValue
mSelectedNumericalStatistics.getMedianValue();
22.
23.
mNumericalMedianLabel.setText(lFormat.format(lMedianValue));
double lVariance
mSelectedNumericalStatistics.getVariance();
24.
25.
mNumericalVarianceLabel.setText(lFormat.format(lVariance));
double lInterQuantileRange
26.
27.
mSelectedNumericalStatistics.getInterQuartileRange();
28.
mNumericalInterQuartileRangeLabel.setText(
29.
lFormat.format(lInterQuantileRange));
double lStandardDeviation
30.
31.
mSelectedNumericalStatistics.getStandardDeviation();
32.
mNumericalStandardDeviationLabel.setText(
33.
lFormat.format(lStandardDeviation));
double lRange
lMaxValue
lMinValue;
34.
double lMeanPercent
(lMeanValue
lMinValue) / lRange;
35.
double lMedianPercent
(lMedianValue
lMinValue) / lRange;
36.
37.
mNumericalMeanSlider.setModel(
38.
new DefaultBoundedRangeModel((int)(lMeanPercent * 100),
39.
1, 0, 100));
40.
if (lMedianValue > lMinValue && lMedianValue < lMaxValue)
Search WWH ::
Custom Search