Package org.jfree.data.time
Class TimePeriodValues
java.lang.Object
org.jfree.data.general.Series
org.jfree.data.time.TimePeriodValues
- All Implemented Interfaces:
Serializable,Cloneable
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ListThe list of data pairs in the series.protected static final StringDefault value for the domain description.protected static final StringDefault value for the range description.private StringA description of the domain.private intIndex of the time period with the maximum end milliseconds.private intIndex of the time period with the maximum middle milliseconds.private intIndex of the time period with the maximum start milliseconds.private intIndex of the time period with the minimum end milliseconds.private intIndex of the time period with the minimum middle milliseconds.private intIndex of the time period with the minimum start milliseconds.private StringA description of the range.(package private) static final longFor serialization. -
Constructor Summary
ConstructorsConstructorDescriptionTimePeriodValues(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 TypeMethodDescriptionvoidadd(TimePeriod period, double value) Adds a new data item to the series and sends aSeriesChangeEventto all registered listeners.voidadd(TimePeriod period, Number value) Adds a new data item to the series and sends aSeriesChangeEventto all registered listeners.voidadd(TimePeriodValue item) Adds a data item to the series and sends aSeriesChangeEventto all registered listeners.clone()Returns a clone of the collection.createCopy(int start, int end) Creates a new instance by copying a subset of the data in this collection.voiddelete(int start, int end) Deletes data from start until end index (end inclusive) and sends aSeriesChangeEventto all registered listeners.booleanTests the series for equality with another object.getDataItem(int index) Returns one data item for the series.Returns the domain description.intReturns the number of items in the series.intReturns the index of the time period with the maximum end milliseconds.intReturns the index of the time period with the maximum middle milliseconds.intReturns the index of the time period with the maximum start milliseconds.intReturns the index of the time period with the minimum end milliseconds.intReturns the index of the time period with the minimum middle milliseconds.intReturns the index of the time period with the minimum start milliseconds.Returns the range description.getTimePeriod(int index) Returns the time period at the specified index.getValue(int index) Returns the value at the specified index.inthashCode()Returns a hash code value for the object.private voidRecalculates the bounds for the collection of items.voidsetDomainDescription(String description) Sets the domain description and fires a property change event (with the property nameDomainif the description changes).voidsetRangeDescription(String description) Sets the range description and fires a property change event with the nameRange.voidUpdates (changes) the value of a data item and sends aSeriesChangeEventto all registered listeners.private voidupdateBounds(TimePeriod period, int index) Update the index values for the maximum and minimum bounds.Methods inherited from class org.jfree.data.general.Series
addChangeListener, addPropertyChangeListener, addVetoableChangeListener, canEqual, firePropertyChange, fireSeriesChanged, fireVetoableChange, getDescription, getKey, getNotify, isEmpty, notifyListeners, removeChangeListener, removePropertyChangeListener, removeVetoableChangeListener, setDescription, setKey, setNotify
-
Field Details
-
serialVersionUID
static final long serialVersionUIDFor serialization.- See Also:
-
DEFAULT_DOMAIN_DESCRIPTION
Default value for the domain description.- See Also:
-
DEFAULT_RANGE_DESCRIPTION
Default value for the range description.- See Also:
-
domain
A description of the domain. -
range
A description of the range. -
data
The list of data pairs in the series. -
minStartIndex
private int minStartIndexIndex of the time period with the minimum start milliseconds. -
maxStartIndex
private int maxStartIndexIndex of the time period with the maximum start milliseconds. -
minMiddleIndex
private int minMiddleIndexIndex of the time period with the minimum middle milliseconds. -
maxMiddleIndex
private int maxMiddleIndexIndex of the time period with the maximum middle milliseconds. -
minEndIndex
private int minEndIndexIndex of the time period with the minimum end milliseconds. -
maxEndIndex
private int maxEndIndexIndex of the time period with the maximum end milliseconds.
-
-
Constructor Details
-
TimePeriodValues
Creates a new (empty) collection of time period values.- Parameters:
name- the name of the series (nullnot permitted).
-
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 (nullnot permitted).domain- the domain description.range- the range description.
-
-
Method Details
-
getDomainDescription
Returns the domain description.- Returns:
- The domain description (possibly
null). - See Also:
-
setDomainDescription
Sets the domain description and fires a property change event (with the property nameDomainif the description changes).- Parameters:
description- the new description (nullpermitted).- See Also:
-
getRangeDescription
Returns the range description.- Returns:
- The range description (possibly
null). - See Also:
-
setRangeDescription
Sets the range description and fires a property change event with the nameRange.- Parameters:
description- the new description (nullpermitted).- See Also:
-
getItemCount
public int getItemCount()Returns the number of items in the series.- Specified by:
getItemCountin classSeries- Returns:
- The item count.
-
getDataItem
Returns one data item for the series.- Parameters:
index- the item index (in the range0togetItemCount() -1).- Returns:
- One data item for the series.
-
getTimePeriod
Returns the time period at the specified index.- Parameters:
index- the item index (in the range0togetItemCount() -1).- Returns:
- The time period at the specified index.
- See Also:
-
getValue
Returns the value at the specified index.- Parameters:
index- the item index (in the range0togetItemCount() -1).- Returns:
- The value at the specified index (possibly
null). - See Also:
-
add
Adds a data item to the series and sends aSeriesChangeEventto all registered listeners.- Parameters:
item- the item (nullnot permitted).
-
updateBounds
Update the index values for the maximum and minimum bounds.- Parameters:
period- the time period.index- the index of the time period.
-
recalculateBounds
private void recalculateBounds()Recalculates the bounds for the collection of items. -
add
Adds a new data item to the series and sends aSeriesChangeEventto all registered listeners.- Parameters:
period- the time period (nullnot permitted).value- the value.- See Also:
-
add
Adds a new data item to the series and sends aSeriesChangeEventto all registered listeners.- Parameters:
period- the time period (nullnot permitted).value- the value (nullpermitted).
-
update
Updates (changes) the value of a data item and sends aSeriesChangeEventto all registered listeners.- Parameters:
index- the index of the data item to update.value- the new value (nullnot permitted).
-
delete
public void delete(int start, int end) Deletes data from start until end index (end inclusive) and sends aSeriesChangeEventto all registered listeners.- 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:
clonein 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.
-