- java.lang.Object
-
- org.jfree.data.general.Series<S>
-
- org.jfree.data.time.TimePeriodValues<S>
-
- All Implemented Interfaces:
Serializable,Cloneable
public class TimePeriodValues<S extends Comparable<S>> extends Series<S> implements Serializable
A structure containing zero, one or manyTimePeriodValueinstances. The time periods can overlap, and are maintained in the order that they are added to the collection.This is similar to the
TimeSeriesclass, except that the time periods can have irregular lengths.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimePeriodValues(S name)Creates a new (empty) collection of time period values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(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.Objectclone()Returns a clone of the collection.TimePeriodValuescreateCopy(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.booleanequals(Object obj)Tests the series for equality with another object.TimePeriodValuegetDataItem(int index)Returns one data item for the series.intgetItemCount()Returns the number of items in the series.intgetMaxEndIndex()Returns the index of the time period with the maximum end milliseconds.intgetMaxMiddleIndex()Returns the index of the time period with the maximum middle milliseconds.intgetMaxStartIndex()Returns the index of the time period with the maximum start milliseconds.intgetMinEndIndex()Returns the index of the time period with the minimum end milliseconds.intgetMinMiddleIndex()Returns the index of the time period with the minimum middle milliseconds.intgetMinStartIndex()Returns the index of the time period with the minimum start milliseconds.TimePeriodgetTimePeriod(int index)Returns the time period at the specified index.NumbergetValue(int index)Returns the value at the specified index.inthashCode()Returns a hash code value for the object.voidupdate(int index, Number value)Updates (changes) the value of a data item and sends aSeriesChangeEventto all registered listeners.-
Methods inherited from class org.jfree.data.general.Series
addChangeListener, fireSeriesChanged, getKey, getNotify, isEmpty, notifyListeners, removeChangeListener, setNotify
-
-
-
-
Constructor Detail
-
TimePeriodValues
public TimePeriodValues(S name)
Creates a new (empty) collection of time period values.- Parameters:
name- the name of the series (nullnot permitted).
-
-
Method Detail
-
getItemCount
public int getItemCount()
Returns the number of items in the series.- Specified by:
getItemCountin classSeries<S extends Comparable<S>>- Returns:
- The item count.
-
getDataItem
public TimePeriodValue getDataItem(int index)
Returns one data item for the series.- Parameters:
index- the item index (in the range0togetItemCount() -1).- Returns:
- One data item for the series.
-
getTimePeriod
public TimePeriod getTimePeriod(int index)
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:
getDataItem(int)
-
getValue
public Number getValue(int index)
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:
getDataItem(int)
-
add
public void add(TimePeriodValue item)
Adds a data item to the series and sends aSeriesChangeEventto all registered listeners.- Parameters:
item- the item (nullnot permitted).
-
add
public void add(TimePeriod period, double value)
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(TimePeriod, Number)
-
add
public void add(TimePeriod period, Number value)
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
public void update(int index, Number value)
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
public boolean equals(Object obj)
Tests the series for equality with another object.- Overrides:
equalsin classSeries<S extends Comparable<S>>- Parameters:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCodein classSeries<S extends Comparable<S>>- Returns:
- The hashcode
-
clone
public Object clone() throws CloneNotSupportedException
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<S extends Comparable<S>>- Returns:
- A clone of the time series.
- Throws:
CloneNotSupportedException- if there is a cloning problem.
-
createCopy
public TimePeriodValues createCopy(int start, int end) throws CloneNotSupportedException
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.
-
-