org.jfree.data.time
public class TimeSeries extends Series implements Cloneable, Serializable
Field Summary | |
---|---|
protected List | data The list of data items in the series. |
protected static String | DEFAULT_DOMAIN_DESCRIPTION Default value for the domain description. |
protected static String | DEFAULT_RANGE_DESCRIPTION Default value for the range description. |
protected Class | timePeriodClass The type of period for the data. |
Constructor Summary | |
---|---|
TimeSeries(Comparable name)
Creates a new (empty) time series. | |
TimeSeries(Comparable name, String domain, String range)
Creates a new time series that contains no data.
| |
TimeSeries(Comparable name, Class timePeriodClass)
Creates a new (empty) time series with the specified name and class
of RegularTimePeriod.
| |
TimeSeries(Comparable name, String domain, String range, Class timePeriodClass)
Creates a new time series that contains no data.
|
Method Summary | |
---|---|
void | add(TimeSeriesDataItem item)
Adds a data item to the series and sends a SeriesChangeEvent to
all registered listeners.
|
void | add(TimeSeriesDataItem item, boolean notify)
Adds a data item to the series and sends a SeriesChangeEvent to
all registered listeners.
|
void | add(RegularTimePeriod period, double value)
Adds a new data item to the series and sends a SeriesChangeEvent
to all registered listeners.
|
void | add(RegularTimePeriod period, double value, boolean notify)
Adds a new data item to the series and sends a SeriesChangeEvent
to all registered listeners.
|
void | add(RegularTimePeriod period, Number value)
Adds a new data item to the series and sends
a SeriesChangeEvent to all registered
listeners.
|
void | add(RegularTimePeriod period, Number value, boolean notify)
Adds a new data item to the series and sends a SeriesChangeEvent
to all registered listeners.
|
TimeSeries | addAndOrUpdate(TimeSeries series)
Adds or updates data from one series to another. |
TimeSeriesDataItem | addOrUpdate(RegularTimePeriod period, double value)
Adds or updates an item in the times series and sends a
SeriesChangeEvent to all registered
listeners.
|
TimeSeriesDataItem | addOrUpdate(RegularTimePeriod period, Number value)
Adds or updates an item in the times series and sends a
SeriesChangeEvent to all registered
listeners.
|
void | clear()
Removes all data items from the series and sends a
SeriesChangeEvent to all registered listeners. |
Object | clone()
Returns a clone of the time series.
|
TimeSeries | createCopy(int start, int end)
Creates a new timeseries by copying a subset of the data in this time
series.
|
TimeSeries | createCopy(RegularTimePeriod start, RegularTimePeriod end)
Creates a new timeseries by copying a subset of the data in this time
series.
|
void | delete(RegularTimePeriod period)
Deletes the data item for the given time period and sends a
SeriesChangeEvent to all registered listeners. |
void | delete(int start, int end)
Deletes data from start until end index (end inclusive).
|
boolean | equals(Object object)
Tests the series for equality with an arbitrary object.
|
TimeSeriesDataItem | getDataItem(int index)
Returns a data item for the series.
|
TimeSeriesDataItem | getDataItem(RegularTimePeriod period)
Returns the data item for a specific period.
|
String | getDomainDescription()
Returns the domain description.
|
int | getIndex(RegularTimePeriod period)
Returns the index for the item (if any) that corresponds to a time
period.
|
int | getItemCount()
Returns the number of items in the series.
|
List | getItems()
Returns the list of data items for the series (the list contains
TimeSeriesDataItem objects and is unmodifiable).
|
long | getMaximumItemAge()
Returns the maximum item age (in time periods) for the series.
|
int | getMaximumItemCount()
Returns the maximum number of items that will be retained in the series.
|
RegularTimePeriod | getNextTimePeriod()
Returns a time period that would be the next in sequence on the end of
the time series.
|
String | getRangeDescription()
Returns the range description.
|
RegularTimePeriod | getTimePeriod(int index)
Returns the time period at the specified index.
|
Class | getTimePeriodClass()
Returns the time period class for this series.
|
Collection | getTimePeriods()
Returns a collection of all the time periods in the time series.
|
Collection | getTimePeriodsUniqueToOtherSeries(TimeSeries series)
Returns a collection of time periods in the specified series, but not in
this series, and therefore unique to the specified series.
|
Number | getValue(int index)
Returns the value at the specified index.
|
Number | getValue(RegularTimePeriod period)
Returns the value for a time period. |
int | hashCode()
Returns a hash code value for the object.
|
void | removeAgedItems(boolean notify)
Age items in the series. |
void | removeAgedItems(long latest, boolean notify)
Age items in the series. |
void | setDomainDescription(String description)
Sets the domain description and sends a PropertyChangeEvent
(with the property name Domain ) to all registered
property change listeners.
|
void | setMaximumItemAge(long periods)
Sets the number of time units in the 'history' for the series. |
void | setMaximumItemCount(int maximum)
Sets the maximum number of items that will be retained in the series.
|
void | setRangeDescription(String description)
Sets the range description and sends a PropertyChangeEvent
(with the property name Range ) to all registered listeners.
|
void | update(RegularTimePeriod period, Number value)
Updates (changes) the value for a time period. |
void | update(int index, Number value)
Updates (changes) the value of a data item.
|
Parameters: name the series name (null
not permitted).
Descriptions can be specified for the domain and range. One situation where this is helpful is when generating a chart for the time series - axis labels can be taken from the domain and range description.
Parameters: name the name of the series (null
not permitted). domain the domain description (null
permitted). range the range description (null
permitted).
Since: 1.0.13
Deprecated: As of 1.0.13, it is not necessary to specify the
timePeriodClass
as this will be inferred when the
first data item is added to the dataset.
Parameters: name the series name (null
not permitted). timePeriodClass the type of time period (null
not
permitted).
Deprecated: As of 1.0.13, it is not necessary to specify the
timePeriodClass
as this will be inferred when the
first data item is added to the dataset.
Descriptions can be specified for the domain and range. One situation where this is helpful is when generating a chart for the time series - axis labels can be taken from the domain and range description.
Parameters: name the name of the series (null
not permitted). domain the domain description (null
permitted). range the range description (null
permitted). timePeriodClass the type of time period (null
not
permitted).
Parameters: item the (timeperiod, value) pair (null
not
permitted).
Parameters: item the (timeperiod, value) pair (null
not
permitted). notify notify listeners?
Parameters: period the time period (null
not permitted). value the value.
Parameters: period the time period (null
not permitted). value the value. notify notify listeners?
Parameters: period the time period (null
not permitted). value the value (null
permitted).
Parameters: period the time period (null
not permitted). value the value (null
permitted). notify notify listeners?
Parameters: series the series to merge with this.
Returns: A series containing the values that were overwritten.
Parameters: period the time period to add/update (null
not
permitted). value the new value.
Returns: A copy of the overwritten data item, or null
if no
item was overwritten.
Parameters: period the time period to add/update (null
not
permitted). value the new value (null
permitted).
Returns: A copy of the overwritten data item, or null
if no
item was overwritten.
Notes:
Returns: A clone of the time series.
Throws: CloneNotSupportedException not thrown by this class, but subclasses may differ.
Parameters: start the index of the first time period to copy. end the index of the last time period to copy.
Returns: A series containing a copy of this times series from start until end.
Throws: CloneNotSupportedException if there is a cloning problem.
Parameters: start the first time period to copy (null
not
permitted). end the last time period to copy (null
not
permitted).
Returns: A time series containing a copy of this time series from start until end.
Throws: CloneNotSupportedException if there is a cloning problem.
Parameters: period the period of the item to delete (null
not
permitted).
Parameters: start the index of the first period to delete. end the index of the last period to delete.
Parameters: object the object to test against (null
permitted).
Returns: A boolean.
Parameters: index the item index (zero-based).
Returns: The data item.
See Also: getDataItem
Parameters: period the period of interest (null
not allowed).
Returns: The data item matching the specified period (or
null
if there is no match).
See Also: TimeSeries
Returns: The domain description (possibly null
).
See Also: setDomainDescription
Parameters: period the time period (null
not permitted).
Returns: The index.
Returns: The item count.
Returns: The list of data items.
Returns: The maximum item age.
See Also: TimeSeries
Integer.MAX_VALUE
.
Returns: The maximum item count.
See Also: TimeSeries
Returns: The next time period.
Returns: The range description (possibly null
).
See Also: setRangeDescription
Parameters: index the index of the data item.
Returns: The time period.
Only one time period class can be used within a single series (enforced). If you add a data item with a Year for the time period, then all subsequent data items must also have a Year for the time period.
Returns: The time period class (may be null
but only for
an empty series).
Returns: A collection of all the time periods.
Parameters: series the series to check against this one.
Returns: The unique time periods.
Parameters: index index of a value.
Returns: The value (possibly null
).
null
.
Parameters: period time period (null
not permitted).
Returns: The value (possibly null
).
Returns: The hashcode
Parameters: notify controls whether or not a SeriesChangeEvent is sent to registered listeners IF any items are removed.
Parameters: latest the time to be compared against when aging data (specified in milliseconds). notify controls whether or not a SeriesChangeEvent is sent to registered listeners IF any items are removed.
PropertyChangeEvent
(with the property name Domain
) to all registered
property change listeners.
Parameters: description the description (null
permitted).
See Also: getDomainDescription
Parameters: periods the number of time periods.
See Also: getMaximumItemAge
Parameters: maximum the maximum (requires >= 0).
See Also: getMaximumItemCount
PropertyChangeEvent
(with the property name Range
) to all registered listeners.
Parameters: description the description (null
permitted).
See Also: getRangeDescription
Parameters: period the period (null
not permitted). value the value (null
permitted).
Parameters: index the index of the data item. value the new value (null
permitted).