@Test public void testAddSeries() { DefaultXYZDataset d = new DefaultXYZDataset(); d.addSeries("S1", new double[][] {{1.0}, {2.0}, {3.0}}); assertEquals(1, d.getSeriesCount()); assertEquals("S1", d.getSeriesKey(0)); d.addSeries("S1", new double[][] {{11.0}, {12.0}, {13.0}}); assertEquals(1, d.getSeriesCount()); assertEquals(12.0, d.getYValue(0, 0), EPSILON); try { d.addSeries(null, new double[][] {{1.0}, {2.0}, {3.0}}); fail("IllegalArgumentException should have been thrown on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'seriesKey' argument.", e.getMessage()); } }
public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException( "The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException("The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); }
DefaultXYZDataset extends AbstractXYZDataset implements XYZDataset, PublicCloneable { public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException( "The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException("The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); } }
DefaultXYZDataset extends AbstractXYZDataset implements XYZDataset, PublicCloneable { public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException( "The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException("The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); } DefaultXYZDataset(); }
DefaultXYZDataset extends AbstractXYZDataset implements XYZDataset, PublicCloneable { public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException( "The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException("The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); } DefaultXYZDataset(); @Override int getSeriesCount(); @Override Comparable getSeriesKey(int series); @Override int indexOf(Comparable seriesKey); @Override DomainOrder getDomainOrder(); @Override int getItemCount(int series); @Override double getXValue(int series, int item); @Override Number getX(int series, int item); @Override double getYValue(int series, int item); @Override Number getY(int series, int item); @Override double getZValue(int series, int item); @Override Number getZ(int series, int item); void addSeries(Comparable seriesKey, double[][] data); void removeSeries(Comparable seriesKey); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
DefaultXYZDataset extends AbstractXYZDataset implements XYZDataset, PublicCloneable { public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException( "The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException("The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); } DefaultXYZDataset(); @Override int getSeriesCount(); @Override Comparable getSeriesKey(int series); @Override int indexOf(Comparable seriesKey); @Override DomainOrder getDomainOrder(); @Override int getItemCount(int series); @Override double getXValue(int series, int item); @Override Number getX(int series, int item); @Override double getYValue(int series, int item); @Override Number getY(int series, int item); @Override double getZValue(int series, int item); @Override Number getZ(int series, int item); void addSeries(Comparable seriesKey, double[][] data); void removeSeries(Comparable seriesKey); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }