Package org.jfree.data.time
Class TimePeriodValues
java.lang.Object
org.jfree.data.Series
org.jfree.data.time.TimePeriodValues
- All Implemented Interfaces:
Serializable
,Cloneable
public class TimePeriodValues extends Series implements Serializable
A structure containing zero, one or many
TimePeriodValue
instances.
The time periods can overlap, and are maintained in the order that they are
added to the collection.
This is similar to the TimeSeries
class, except that the time periods
can have irregular lengths.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description TimePeriodValues(String name)
Creates a new (empty) collection of time period values.TimePeriodValues(String name, String domain, String range)
Creates a new time series that contains no data. -
Method Summary
Modifier and Type Method Description void
add(TimePeriod period, double value)
Adds a new data item to the series.void
add(TimePeriod period, Number value)
Adds a new data item to the series.void
add(TimePeriodValue item)
Adds a data item to the series.Object
clone()
Returns a clone of the collection.TimePeriodValues
createCopy(int start, int end)
Creates a new instance by copying a subset of the data in this collection.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 another object.TimePeriodValue
getDataItem(int index)
Returns one data item for the series.String
getDomainDescription()
Returns the domain description.int
getItemCount()
Returns the number of items in the series.int
getMaxEndIndex()
Returns the index of the time period with the maximum end milliseconds.int
getMaxMiddleIndex()
Returns the index of the time period with the maximum middle milliseconds.int
getMaxStartIndex()
Returns the index of the time period with the maximum start milliseconds.int
getMinEndIndex()
Returns the index of the time period with the minimum end milliseconds.int
getMinMiddleIndex()
Returns the index of the time period with the minimum middle milliseconds.int
getMinStartIndex()
Returns the index of the time period with the minimum start milliseconds.String
getRangeDescription()
Returns the range description.TimePeriod
getTimePeriod(int index)
Returns the time period at the specified index.Number
getValue(int index)
Returns the value at the specified index.int
hashCode()
Returns a hash code value for the object.void
setDomainDescription(String description)
Sets the domain description.void
setRangeDescription(String description)
Sets the range description.void
update(int index, Number value)
Updates (changes) the value of a data item.Methods inherited from class org.jfree.data.Series
addChangeListener, addPropertyChangeListener, fireSeriesChanged, getDescription, getName, getNotify, removeChangeListener, removePropertyChangeListener, setDescription, setName, setNotify
-
Constructor Details
-
TimePeriodValues
Creates a new (empty) collection of time period values.- Parameters:
name
- the name of the series.
-
TimePeriodValues
Creates a new time series that contains no data.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.domain
- the domain description.range
- the range description.
-
-
Method Details
-
getDomainDescription
Returns the domain description.- Returns:
- the domain description.
-
setDomainDescription
Sets the domain description.A property change event is fired, and an undoable edit is posted.
- Parameters:
description
- the new description.
-
getRangeDescription
Returns the range description.- Returns:
- the range description.
-
setRangeDescription
Sets the range description.Registered listeners are notified of the change.
- Parameters:
description
- the new description.
-
getItemCount
public int getItemCount()Returns the number of items in the series.- Returns:
- the item count.
-
getDataItem
Returns one data item for the series.- Parameters:
index
- the item index (zero-based).- Returns:
- one data item for the series.
-
getTimePeriod
Returns the time period at the specified index.- Parameters:
index
- the index of the data pair.- Returns:
- the time period at the specified index.
-
getValue
Returns the value at the specified index.- Parameters:
index
- index of a value.- Returns:
- the value at the specified index.
-
add
Adds a data item to the series.- Parameters:
item
- the (timeperiod, value) pair.
-
add
Adds a new data item to the series.- Parameters:
period
- the time period.value
- the value.
-
add
Adds a new data item to the series.- Parameters:
period
- the time period.value
- the value.
-
update
Updates (changes) the value of a data item.- Parameters:
index
- the index of the data item to update.value
- the new value.
-
delete
public void delete(int start, int end)Deletes data from start until end index (end inclusive).- Parameters:
start
- the index of the first period to delete.end
- the index of the last period to delete.
-
equals
Tests the series for equality with another object. -
hashCode
public int hashCode()Returns a hash code value for the object. -
clone
Returns a clone of the collection.Notes:
- no need to clone the domain and range descriptions, since String object is immutable;
- we pass over to the more general method createCopy(start, end).
- Overrides:
clone
in classSeries
- Returns:
- a clone of the time series.
- Throws:
CloneNotSupportedException
- if there is a cloning problem.
-
createCopy
Creates a new instance by copying a subset of the data in this collection.- Parameters:
start
- the index of the first item to copy.end
- the index of the last item to copy.- Returns:
- A copy of a subset of the items.
- Throws:
CloneNotSupportedException
- if there is a cloning problem.
-
getMinStartIndex
public int getMinStartIndex()Returns the index of the time period with the minimum start milliseconds.- Returns:
- The index.
-
getMaxStartIndex
public int getMaxStartIndex()Returns the index of the time period with the maximum start milliseconds.- Returns:
- The index.
-
getMinMiddleIndex
public int getMinMiddleIndex()Returns the index of the time period with the minimum middle milliseconds.- Returns:
- The index.
-
getMaxMiddleIndex
public int getMaxMiddleIndex()Returns the index of the time period with the maximum middle milliseconds.- Returns:
- The index.
-
getMinEndIndex
public int getMinEndIndex()Returns the index of the time period with the minimum end milliseconds.- Returns:
- The index.
-
getMaxEndIndex
public int getMaxEndIndex()Returns the index of the time period with the maximum end milliseconds.- Returns:
- The index.
-