/** * Return the data item with the specified index. * * @param index the index. * * @return The data item with the specified index. */ public XYDataItem getDataItem(int index) { XYDataItem item = (XYDataItem) this.data.get(index); return (XYDataItem) item.clone(); }
/** * Return the data item with the specified index. * * @param index the index. * * @return The data item with the specified index. */ public XYDataItem getDataItem(int index) { XYDataItem item = (XYDataItem) this.data.get(index); return (XYDataItem) item.clone(); }
/** * Creates a new series by copying a subset of the data in this time series. * * @param start the index of the first item to copy. * @param end the index of the last item to copy. * * @return A series containing a copy of this series from start until end. * * @throws CloneNotSupportedException if there is a cloning problem. */ public XYSeries createCopy(int start, int end) throws CloneNotSupportedException { XYSeries copy = (XYSeries) super.clone(); copy.data = new java.util.ArrayList(); if (this.data.size() > 0) { for (int index = start; index <= end; index++) { XYDataItem item = (XYDataItem) this.data.get(index); XYDataItem clone = (XYDataItem) item.clone(); try { copy.add(clone); } catch (SeriesException e) { throw new RuntimeException( "Unable to add cloned data item.", e); } } } return copy; }
/** * Creates a new series by copying a subset of the data in this time series. * * @param start the index of the first item to copy. * @param end the index of the last item to copy. * * @return A series containing a copy of this series from start until end. * * @throws CloneNotSupportedException if there is a cloning problem. */ public XYSeries createCopy(int start, int end) throws CloneNotSupportedException { XYSeries copy = (XYSeries) super.clone(); copy.data = new java.util.ArrayList(); if (this.data.size() > 0) { for (int index = start; index <= end; index++) { XYDataItem item = (XYDataItem) this.data.get(index); XYDataItem clone = (XYDataItem) item.clone(); try { copy.add(clone); } catch (SeriesException e) { System.err.println("Unable to add cloned data item."); } } } return copy; }
throw new IllegalArgumentException("Null 'item' argument."); item = (XYDataItem) item.clone(); if (this.autoSort) { int index = Collections.binarySearch(this.data, item);
item = (XYDataItem) item.clone(); if (this.autoSort) { int index = Collections.binarySearch(this.data, item);