/** * Removes the item with the specified x-value and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value. * @return The item removed. */ public ComparableObjectItem remove(Comparable x) { return remove(indexOf(x)); }
/** * Removes the item with the specified x-value and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value. * @return The item removed. */ public ComparableObjectItem remove(Comparable x) { return remove(indexOf(x)); }
int index = indexOf(item.getComparable()); if (index >= 0) { throw new SeriesException("X-value already exists.");
int index = indexOf(item.getComparable()); if (index >= 0) { throw new SeriesException("X-value already exists.");
/** * Updates an item in the series. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ protected void update(Comparable x, Object y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } else { ComparableObjectItem item = getDataItem(index); item.setObject(y); fireSeriesChanged(); } }
/** * Updates an item in the series. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * * @throws SeriesException if there is no existing item with the specified * x-value. */ protected void update(Comparable x, Object y) { int index = indexOf(x); if (index < 0) { throw new SeriesException("No observation for x = " + x); } else { ComparableObjectItem item = getDataItem(index); item.setObject(y); fireSeriesChanged(); } }