コード例 #1
0
  /**
   * Called when one of the sliding window size or step values has changed. This attempts to be
   * 'smart' and instead of recalculating everything from scratch,
   */
  private void newWindowSizeAction() {
    if (sgSeriesMap == null) return;

    XYSeries data;
    int windowSize = (Integer) windowSizeSpinner.getValue();
    int windowStep = (Integer) windowStepSpinner.getValue();
    int tot = 0;

    for (AbstractSeries series : chart.getAllSeries()) {
      if (series instanceof BaseCounterSeries) {
        BaseCounterSeries bcSer = (BaseCounterSeries) series;
        BaseCounter bc = bcSer.getCalculator();
        int partitionIndex = bcSer.getPartitionIndex();
        // System.out.println("Replacing series for calc with name : " + bcSer.getName() + " and
        // partition : " + bcSer.getPartitionIndex());
        if (partitionIndex > -1) {
          bcSer.replaceSeries(bc.getWindowPointSeries(windowSize, windowStep, partitionIndex));
        } else bcSer.replaceSeries(bc.getWindowPointSeries(windowSize, windowStep));
      } else {
        // System.err.println("Hmm, one of the series (" + series.getName() + ") is not a
        // basecounter, cannot recalculate it for the new window size.");/
      }
    }

    chart.repaint();
  }