/** * Returns a data item for the series. This method returns the object * that is used for the underlying storage - you should not modify the * contents of the returned value unless you know what you are doing. * * @param period the item index (zero-based). * * @return The data item. * * @see #getDataItem(RegularTimePeriod) * * @since 1.0.14 */ TimeSeriesDataItem getRawDataItem(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return (TimeSeriesDataItem) this.data.get(index); } return null; }
/** * Returns a data item for the series. This method returns the object * that is used for the underlying storage - you should not modify the * contents of the returned value unless you know what you are doing. * * @param period the item index (zero-based). * * @return The data item. * * @see #getDataItem(RegularTimePeriod) * * @since 1.0.14 */ TimeSeriesDataItem getRawDataItem(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return (TimeSeriesDataItem) this.data.get(index); } else { return null; } }
/** * Returns the value for a time period. If there is no data item with the * specified period, this method will return {@code null}. * * @param period time period ({@code null} not permitted). * * @return The value (possibly {@code null}). */ public Number getValue(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getValue(index); } return null; }
/** * Returns the value for a time period. If there is no data item with the * specified period, this method will return <code>null</code>. * * @param period time period (<code>null</code> not permitted). * * @return The value (possibly <code>null</code>). */ public Number getValue(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getValue(index); } else { return null; } }
/** * Returns the data item for a specific period. Note that the returned * object is a clone of the item in the series, so modifying it will have * no effect on the data series. * * @param period the period of interest ({@code null} not allowed). * * @return The data item matching the specified period (or * {@code null} if there is no match). * * @see #getDataItem(int) */ public TimeSeriesDataItem getDataItem(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getDataItem(index); } return null; }
/** * Returns the data item for a specific period. Note that the returned * object is a clone of the item in the series, so modifying it will have * no effect on the data series. * * @param period the period of interest (<code>null</code> not allowed). * * @return The data item matching the specified period (or * <code>null</code> if there is no match). * * @see #getDataItem(int) */ public TimeSeriesDataItem getDataItem(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getDataItem(index); } else { return null; } }
/** * Returns a collection of time periods in the specified series, but not in * this series, and therefore unique to the specified series. * * @param series the series to check against this one. * * @return The unique time periods. */ public Collection getTimePeriodsUniqueToOtherSeries(TimeSeries series) { Collection result = new java.util.ArrayList(); for (int i = 0; i < series.getItemCount(); i++) { RegularTimePeriod period = series.getTimePeriod(i); int index = getIndex(period); if (index < 0) { result.add(period); } } return result; }
/** * Returns a collection of time periods in the specified series, but not in * this series, and therefore unique to the specified series. * * @param series the series to check against this one. * * @return The unique time periods. */ public Collection getTimePeriodsUniqueToOtherSeries(TimeSeries series) { Collection result = new java.util.ArrayList(); for (int i = 0; i < series.getItemCount(); i++) { RegularTimePeriod period = series.getTimePeriod(i); int index = getIndex(period); if (index < 0) { result.add(period); } } return result; }
/** * 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(); } }