/** * Returns the x-value at the specified index. * * @param index the index (zero-based). * * @return The x-value (never {@code null}). */ public Number getX(int index) { return getRawDataItem(index).getX(); }
/** * Returns the y-value at the specified index. * * @param index the index (zero-based). * * @return The y-value (possibly {@code null}). */ public Number getY(int index) { return getRawDataItem(index).getY(); }
/** * Returns the y-value at the specified index. * * @param index the index (zero-based). * * @return The y-value (possibly <code>null</code>). */ public Number getY(int index) { return getRawDataItem(index).getY(); }
/** * Returns the x-value at the specified index. * * @param index the index (zero-based). * * @return The x-value (never <code>null</code>). */ public Number getX(int index) { return getRawDataItem(index).getX(); }
/** * Returns a hash code. * * @return A hash code. */ public int hashCode() { int result = super.hashCode(); // it is too slow to look at every data item, so let's just look at // the first, middle and last items... int count = getItemCount(); if (count > 0) { XYDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { XYDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { XYDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (this.autoSort ? 1 : 0); result = 29 * result + (this.allowDuplicateXValues ? 1 : 0); return result; }
/** * Returns a hash code. * * @return A hash code. */ @Override public int hashCode() { int result = super.hashCode(); // it is too slow to look at every data item, so let's just look at // the first, middle and last items... int count = getItemCount(); if (count > 0) { XYDataItem item = getRawDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { XYDataItem item = getRawDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { XYDataItem item = getRawDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (this.autoSort ? 1 : 0); result = 29 * result + (this.allowDuplicateXValues ? 1 : 0); return result; }
/** * Updates the value of an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param index the item (zero based index). * @param y the new value ({@code null} permitted). * * @since 1.0.1 */ public void updateByIndex(int index, Number y) { XYDataItem item = getRawDataItem(index); // figure out if we need to iterate through all the y-values boolean iterate = false; double oldY = item.getYValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } item.setY(y); if (iterate) { findBoundsByIteration(); } else if (y != null) { double yy = y.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }
/** * Updates the value of an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param index the item (zero based index). * @param y the new value (<code>null</code> permitted). * * @deprecated Renamed {@link #updateByIndex(int, Number)} to avoid * confusion with the {@link #update(Number, Number)} method. */ public void update(int index, Number y) { XYDataItem item = getRawDataItem(index); // figure out if we need to iterate through all the y-values boolean iterate = false; double oldY = item.getYValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } item.setY(y); if (iterate) { findBoundsByIteration(); } else if (y != null) { double yy = y.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }