/** * Removes all data items from the series and sends a * {@link SeriesChangeEvent} to all registered listeners. */ public void clear() { if (this.data.size() > 0) { this.data.clear(); this.timePeriodClass = null; this.minY = Double.NaN; this.maxY = Double.NaN; fireSeriesChanged(); } }
/** * Removes all data items from the series and sends a * {@link SeriesChangeEvent} to all registered listeners. */ public void clear() { if (this.data.size() > 0) { this.data.clear(); this.timePeriodClass = null; this.minY = Double.NaN; this.maxY = Double.NaN; fireSeriesChanged(); } }
/** * Deletes data from start until end index (end inclusive). * * @param start the index of the first period to delete. * @param end the index of the last period to delete. * @param notify notify listeners? * * @since 1.0.14 */ public void delete(int start, int end, boolean notify) { if (end < start) { throw new IllegalArgumentException("Requires start <= end."); } for (int i = 0; i <= (end - start); i++) { this.data.remove(start); } updateMinMaxYByIteration(); if (this.data.isEmpty()) { this.timePeriodClass = null; } if (notify) { fireSeriesChanged(); } }
/** * Deletes data from start until end index (end inclusive). * * @param start the index of the first period to delete. * @param end the index of the last period to delete. * @param notify notify listeners? * * @since 1.0.14 */ public void delete(int start, int end, boolean notify) { if (end < start) { throw new IllegalArgumentException("Requires start <= end."); } for (int i = 0; i <= (end - start); i++) { this.data.remove(start); } findBoundsByIteration(); if (this.data.isEmpty()) { this.timePeriodClass = null; } if (notify) { fireSeriesChanged(); } }
/** * Deletes the data item for the given time period and sends a * {@link SeriesChangeEvent} to all registered listeners. If there is no * item with the specified time period, this method does nothing. * * @param period the period of the item to delete ({@code null} not * permitted). */ public void delete(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.remove( index); updateBoundsForRemovedItem(item); if (this.data.isEmpty()) { this.timePeriodClass = null; } fireSeriesChanged(); } }
/** * Deletes the data item for the given time period and sends a * {@link SeriesChangeEvent} to all registered listeners. If there is no * item with the specified time period, this method does nothing. * * @param period the period of the item to delete (<code>null</code> not * permitted). */ public void delete(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.remove( index); updateBoundsForRemovedItem(item); if (this.data.isEmpty()) { this.timePeriodClass = null; } fireSeriesChanged(); } }
updateMinMaxYByIteration(); if (notify) { fireSeriesChanged();
findBoundsByIteration(); if (notify) { fireSeriesChanged();
/** * Updates (changes) the value of a data item. * * @param index the index of the data item. * @param value the new value (<code>null</code> permitted). */ public void update(int index, Number value) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.get(index); boolean iterate = false; Number oldYN = item.getValue(); if (oldYN != null) { double oldY = oldYN.doubleValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } } item.setValue(value); if (iterate) { findBoundsByIteration(); } else if (value != null) { double yy = value.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }
/** * Updates (changes) the value of a data item. * * @param index the index of the data item. * @param value the new value ({@code null} permitted). */ public void update(int index, Number value) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.get(index); boolean iterate = false; Number oldYN = item.getValue(); if (oldYN != null) { double oldY = oldYN.doubleValue(); if (!Double.isNaN(oldY)) { iterate = oldY <= this.minY || oldY >= this.maxY; } } item.setValue(value); if (iterate) { updateMinMaxYByIteration(); } else if (value != null) { double yy = value.doubleValue(); this.minY = minIgnoreNaN(this.minY, yy); this.maxY = maxIgnoreNaN(this.maxY, yy); } fireSeriesChanged(); }
/** * Removes all data from the upper plot and sets the {@link TimerData} objects on the plot. * * @param map * The data to set on the plot. */ protected void setCountPlotData(Map<Object, List<E>> map) { for (TimeSeries series : countSeries) { series.clear(); series.setNotify(false); for (Entry<Object, List<E>> entry : map.entrySet()) { if (series.getKey().equals(entry.getKey())) { for (E data : entry.getValue()) { series.addOrUpdate(new Millisecond(data.getTimeStamp()), data.getCount()); } break; } } series.setNotify(true); series.fireSeriesChanged(); } }
fireSeriesChanged(); return overwritten;
fireSeriesChanged(); return overwritten;
/** * Age items in the series. Ensure that the timespan from the youngest to * the oldest record in the series does not exceed maximumItemAge time * periods. Oldest items will be removed if required. * * @param notify controls whether or not a {@link SeriesChangeEvent} is * sent to registered listeners IF any items are removed. */ public void removeAgedItems(boolean notify) { // check if there are any values earlier than specified by the history // count... if (getItemCount() > 1) { long latest = getTimePeriod(getItemCount() - 1).getSerialIndex(); boolean removed = false; while ((latest - getTimePeriod(0).getSerialIndex()) > this.maximumItemAge) { this.data.remove(0); removed = true; } if (removed) { updateMinMaxYByIteration(); if (notify) { fireSeriesChanged(); } } } }
/** * Age items in the series. Ensure that the timespan from the youngest to * the oldest record in the series does not exceed maximumItemAge time * periods. Oldest items will be removed if required. * * @param notify controls whether or not a {@link SeriesChangeEvent} is * sent to registered listeners IF any items are removed. */ public void removeAgedItems(boolean notify) { // check if there are any values earlier than specified by the history // count... if (getItemCount() > 1) { long latest = getTimePeriod(getItemCount() - 1).getSerialIndex(); boolean removed = false; while ((latest - getTimePeriod(0).getSerialIndex()) > this.maximumItemAge) { this.data.remove(0); removed = true; } if (removed) { findBoundsByIteration(); if (notify) { fireSeriesChanged(); } } } }