/*
 * Copyright 2006-2020 The MZmine Development Team
 *
 * This file is part of MZmine.
 *
 * MZmine is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * MZmine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with MZmine; if not,
 * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 * USA
 */

package io.github.mzmine.modules.visualization.spectra.simplespectra.datasets;

import io.github.mzmine.datamodel.MassList;
import org.jfree.data.xy.AbstractXYDataset;

/**
 * Data set for MassList
 */
public class MassListDataSet extends AbstractXYDataset {

  private final double mzValues[], intensityValues[];
  /**
   *
   */
  private static final long serialVersionUID = 1L;

  public MassListDataSet(MassList massList) {
    this.mzValues = new double[massList.getNumberOfDataPoints()];
    this.intensityValues = new double[massList.getNumberOfDataPoints()];
    massList.getMzValues(this.mzValues);
    massList.getIntensityValues(this.intensityValues);
  }

  public MassListDataSet(double mzValues[], double intensityValues[]) {
    this.mzValues = mzValues;
    this.intensityValues = intensityValues;
  }


  @Override
  public int getSeriesCount() {
    return 1;
  }

  @Override
  public Comparable getSeriesKey(int series) {
    return 1;
  }

  @Override
  public int getItemCount(int series) {
    return mzValues.length;
  }

  @Override
  public Number getX(int series, int item) {
    return mzValues[item];
  }

  @Override
  public Number getY(int series, int item) {
    return intensityValues[item];
  }
}

@@ -949,37 +949,150 @@
 et;%0A
-%0A/**%0A * Data set for MassList
+import org.jfree.data.xy.IntervalXYDataset;%0A%0A/**%0A * Data set for MassList. Implements IntervalXYDataset to be used in pair with XYBarRenderer.
 %0A */
@@ -1147,16 +1147,45 @@
 Dataset 
+implements IntervalXYDataset 
 %7B%0A%0A  pri
@@ -2149,11 +2149,827 @@
 em%5D;%0A  %7D
+%0A%0A  @Override%0A  public Number getEndX(int series, int item) %7B%0A    return getX(series, item);%0A  %7D%0A%0A  @Override%0A  public double getEndXValue(int series, int item) %7B%0A    return getXValue(series, item);%0A  %7D%0A%0A  @Override%0A  public Number getEndY(int series, int item) %7B%0A    return getY(series, item);%0A  %7D%0A%0A  @Override%0A  public double getEndYValue(int series, int item) %7B%0A    return getYValue(series, item);%0A  %7D%0A%0A  @Override%0A  public Number getStartX(int series, int item) %7B%0A    return getX(series, item);%0A  %7D%0A%0A  @Override%0A  public double getStartXValue(int series, int item) %7B%0A    return getXValue(series, item);%0A  %7D%0A%0A  @Override%0A  public Number getStartY(int series, int item) %7B%0A    return getY(series, item);%0A  %7D%0A%0A  @Override%0A  public double getStartYValue(int series, int item) %7B%0A    return getYValue(series, item);%0A  %7D
 %0A%7D%0A

Make MassListDataSet implement IntervalXYDataset