|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.data.general.Series
org.jfree.data.time.TimeSeries
Represents a sequence of zero or more data items in the form (period, value).
Field Summary | |
protected java.util.List |
data
The list of data items in the series. |
protected static java.lang.String |
DEFAULT_DOMAIN_DESCRIPTION
Default value for the domain description. |
protected static java.lang.String |
DEFAULT_RANGE_DESCRIPTION
Default value for the range description. |
protected java.lang.Class |
timePeriodClass
The type of period for the data. |
Constructor Summary | |
TimeSeries(java.lang.String name)
Creates a new (empty) time series. |
|
TimeSeries(java.lang.String name,
java.lang.Class timePeriodClass)
Creates a new (empty) time series. |
|
TimeSeries(java.lang.String name,
java.lang.String domain,
java.lang.String range,
java.lang.Class timePeriodClass)
Creates a new time series that contains no data. |
Method Summary | |
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,
java.lang.Number value)
Adds a new data item to the series and sends a SeriesChangeEvent to all registered
listeners. |
void |
add(TimeSeriesDataItem item)
Adds a 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,
java.lang.Number value)
Adds or updates an item in the times series and sends a SeriesChangeEvent to all registered
listeners. |
void |
ageHistoryCountItems()
Age items in the series. |
void |
ageHistoryCountItems(long latest)
Age items in the series. |
void |
clear()
Removes all data items from the series and sends a SeriesChangeEvent
to all registered listeners. |
java.lang.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(int start,
int end)
Deletes data from start until end index (end inclusive). |
void |
delete(RegularTimePeriod period)
Deletes the data item for the given time period and sends a SeriesChangeEvent to all registered
listeners. |
boolean |
equals(java.lang.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. |
java.lang.String |
getDomainDescription()
Returns the domain description. |
int |
getHistoryCount()
Returns the history count for the series. |
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. |
java.util.List |
getItems()
Returns the list of data items for the series (the list contains TimeSeriesDataItem objects and is unmodifiable). |
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. |
java.lang.String |
getRangeDescription()
Returns the range description. |
RegularTimePeriod |
getTimePeriod(int index)
Returns the time period at the specified index. |
java.lang.Class |
getTimePeriodClass()
Returns the time period class for this series. |
java.util.Collection |
getTimePeriods()
Returns a collection of all the time periods in the time series. |
java.util.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. |
java.lang.Number |
getValue(int index)
Returns the value at the specified index. |
java.lang.Number |
getValue(RegularTimePeriod period)
Returns the value for a time period. |
int |
hashCode()
Returns a hash code value for the object. |
void |
setDomainDescription(java.lang.String description)
Sets the domain description. |
void |
setHistoryCount(int 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(java.lang.String description)
Sets the range description and fires a property change event for the 'Range' property. |
void |
update(int index,
java.lang.Number value)
Updates (changes) the value of a data item. |
void |
update(RegularTimePeriod period,
java.lang.Number value)
Updates (changes) the value for a time period. |
Methods inherited from class org.jfree.data.general.Series |
addChangeListener, addPropertyChangeListener, firePropertyChange, fireSeriesChanged, getDescription, getName, getNotify, notifyListeners, removeChangeListener, removePropertyChangeListener, setDescription, setName, setNotify |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String DEFAULT_DOMAIN_DESCRIPTION
protected static final java.lang.String DEFAULT_RANGE_DESCRIPTION
protected java.lang.Class timePeriodClass
protected java.util.List data
Constructor Detail |
public TimeSeries(java.lang.String name)
name
- the series name (null
not permitted).public TimeSeries(java.lang.String name, java.lang.Class timePeriodClass)
name
- the series name (null
not permitted).timePeriodClass
- the type of time period (null
not
permitted).public TimeSeries(java.lang.String name, java.lang.String domain, java.lang.String range, java.lang.Class timePeriodClass)
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.
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).Method Detail |
public java.lang.String getDomainDescription()
null
).public void setDomainDescription(java.lang.String description)
A property change event is fired, and an undoable edit is posted.
description
- the description (null
permitted).public java.lang.String getRangeDescription()
null
).public void setRangeDescription(java.lang.String description)
description
- the description (null
permitted).public int getItemCount()
public java.util.List getItems()
TimeSeriesDataItem
objects and is unmodifiable).
public int getMaximumItemCount()
The default value is Integer.MAX_VALUE
).
public void setMaximumItemCount(int maximum)
If you add a new item to the series such that the number of items will exceed the maximum item count, then the FIRST element in the series is automatically removed, ensuring that the maximum item count is not exceeded.
maximum
- the maximum.public int getHistoryCount()
public void setHistoryCount(int periods)
This provides one mechanism for automatically dropping old data from the time series. For example, if a series contains daily data, you might set the history count to 30. Then, when you add a new data item, all data items more than 30 days older than the latest value are automatically dropped from the series.
periods
- the number of time periods.public java.lang.Class getTimePeriodClass()
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.
null
).public TimeSeriesDataItem getDataItem(int index)
index
- the item index (zero-based).
public TimeSeriesDataItem getDataItem(RegularTimePeriod period)
period
- the period of interest (null
not allowed).
null
if there is no match).public RegularTimePeriod getTimePeriod(int index)
index
- the index of the data item.
public RegularTimePeriod getNextTimePeriod()
public java.util.Collection getTimePeriods()
public java.util.Collection getTimePeriodsUniqueToOtherSeries(TimeSeries series)
series
- the series to check against this one.
public int getIndex(RegularTimePeriod period)
period
- the time period (null
not permitted).
public java.lang.Number getValue(int index)
index
- index of a value.
null
).public java.lang.Number getValue(RegularTimePeriod period)
null
.
period
- time period (null
not permitted).
null
).public void add(TimeSeriesDataItem item)
SeriesChangeEvent
to all registered
listeners.
item
- the (timeperiod, value) pair (null
not
permitted).public void add(RegularTimePeriod period, double value)
SeriesChangeEvent
to all registered
listeners.
period
- the time period (null
not permitted).value
- the value.public void add(RegularTimePeriod period, java.lang.Number value)
SeriesChangeEvent
to all registered
listeners.
period
- the time period (null
not permitted).value
- the value (null
permitted).public void update(RegularTimePeriod period, java.lang.Number value)
SeriesException
if the period does not exist.
period
- the period (null
not permitted).value
- the value (null
permitted).public void update(int index, java.lang.Number value)
index
- the index of the data item.value
- the new value (null
permitted).public TimeSeries addAndOrUpdate(TimeSeries series)
series
- the series to merge with this.
public TimeSeriesDataItem addOrUpdate(RegularTimePeriod period, double value)
SeriesChangeEvent
to all registered
listeners.
period
- the time period to add/update (null
not
permitted).value
- the new value.
null
if no
item was overwritten.public TimeSeriesDataItem addOrUpdate(RegularTimePeriod period, java.lang.Number value)
SeriesChangeEvent
to all registered
listeners.
period
- the time period to add/update (null
not
permitted).value
- the new value (null
permitted).
null
if no
item was overwritten.public void ageHistoryCountItems()
public void ageHistoryCountItems(long latest)
latest
- the time to be compared against when aging data.public void clear()
SeriesChangeEvent
to all registered listeners.
public void delete(RegularTimePeriod period)
SeriesChangeEvent
to all registered
listeners.
period
- the period of the item to delete (null
not
permitted).public void delete(int start, int end)
start
- the index of the first period to delete.end
- the index of the last period to delete.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Notes:
clone
in class Series
java.lang.CloneNotSupportedException
- not thrown by this class, but
subclasses may differ.public TimeSeries createCopy(int start, int end) throws java.lang.CloneNotSupportedException
start
- the index of the first time period to copy.end
- the index of the last time period to copy.
java.lang.CloneNotSupportedException
- if there is a cloning problem.public TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end) throws java.lang.CloneNotSupportedException
start
- the first time period to copy.end
- the last time period to copy.
java.lang.CloneNotSupportedException
- if there is a cloning problem.public boolean equals(java.lang.Object object)
equals
in class Series
object
- the object to test against (null
permitted).
public int hashCode()
hashCode
in class Series
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |