Пример #1
0
 private void setLandscapeCommon(final List<Pair<String, Float>> landscape) {
   this.landscape = landscape;
   if (!stkLineChartZoom.empty()) {
     pnlLineChart.setViewport(stkLineChartZoom.get(0));
     stkLineChartZoom.clear();
   }
   if (landscape == null) {
     landscapeMin = landscapeMax = null;
   } else {
     float min = Float.POSITIVE_INFINITY;
     float max = Float.NEGATIVE_INFINITY;
     for (final Pair<String, Float> p : landscape) {
       final float fitness = p.getSecond();
       if (Float.isInfinite(fitness)) {
         continue;
       }
       if (fitness < min) {
         min = fitness;
       }
       if (fitness > max) {
         max = fitness;
       }
     }
     landscapeMin = new Float(min - max * 0.05);
     landscapeMax = new Float(max * 1.05);
   }
   if (!stkHistogramZoom.empty()) {
     pnlHistogram.setViewport(stkHistogramZoom.get(0));
     stkHistogramZoom.clear();
   }
   if (useMinMax && (landscapeMin != null) && (landscapeMax != null)) {
     pnlHistogram.setBins(
         binLandscape(((Number) spnBins.getValue()).intValue()),
         landscapeMin.floatValue(),
         landscapeMax.floatValue());
   } else {
     pnlHistogram.setBins(binLandscape(((Number) spnBins.getValue()).intValue()));
   }
   // cboDisplayType.setSelectedIndex(0);
   if (landscape == null) {
     txaRaw.setText("");
   } else {
     final StringBuffer b = new StringBuffer();
     if (rawTextComparator != null) {
       Collections.sort(landscape, rawTextComparator);
     }
     b.append(getXAxisLabel());
     b.append('\t');
     b.append(getYAxisLabel());
     b.append('\n');
     for (final Pair<String, Float> p : landscape) {
       b.append(p.getFirst());
       b.append('\t');
       b.append(Float.toString(p.getSecond()));
       b.append('\n');
     }
     txaRaw.setText(b.toString());
     txaRaw.select(0, 0);
   }
 }
Пример #2
0
 public void stateChanged(final ChangeEvent e) {
   if ((landscapeMin != null) && (landscapeMax != null)) {
     pnlHistogram.setBins(
         binLandscape(((Number) spnBins.getValue()).intValue()),
         landscapeMin.floatValue(),
         landscapeMax.floatValue());
   } else {
     pnlHistogram.setBins(binLandscape(((Number) spnBins.getValue()).intValue()));
   }
 }