public class TimePeriodValues extends Series implements java.io.Serializable
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.
| Modifier and Type | Field and Description |
|---|---|
private java.util.List |
data
The list of data pairs 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.
|
private java.lang.String |
domain
A description of the domain.
|
private int |
maxEndIndex
Index of the time period with the maximum end milliseconds.
|
private int |
maxMiddleIndex
Index of the time period with the maximum middle milliseconds.
|
private int |
maxStartIndex
Index of the time period with the maximum start milliseconds.
|
private int |
minEndIndex
Index of the time period with the minimum end milliseconds.
|
private int |
minMiddleIndex
Index of the time period with the minimum middle milliseconds.
|
private int |
minStartIndex
Index of the time period with the minimum start milliseconds.
|
private java.lang.String |
range
A description of the range.
|
(package private) static long |
serialVersionUID
For serialization.
|
| Constructor and Description |
|---|
TimePeriodValues(java.lang.String name)
Creates a new (empty) collection of time period values.
|
TimePeriodValues(java.lang.String name,
java.lang.String domain,
java.lang.String range)
Creates a new time series that contains no data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(TimePeriod period,
double value)
Adds a new data item to the series and sends a
SeriesChangeEvent
to all registered listeners. |
void |
add(TimePeriod period,
java.lang.Number value)
Adds a new data item to the series and sends a
SeriesChangeEvent
to all registered listeners. |
void |
add(TimePeriodValue item)
Adds a data item to the series and sends a
SeriesChangeEvent to
all registered listeners. |
java.lang.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) and sends a
SeriesChangeEvent to all registered listeners. |
boolean |
equals(java.lang.Object obj)
Tests the series for equality with another object.
|
TimePeriodValue |
getDataItem(int index)
Returns one data item for the series.
|
java.lang.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.
|
java.lang.String |
getRangeDescription()
Returns the range description.
|
TimePeriod |
getTimePeriod(int index)
Returns the time period at the specified index.
|
java.lang.Number |
getValue(int index)
Returns the value at the specified index.
|
int |
hashCode()
Returns a hash code value for the object.
|
private void |
recalculateBounds()
Recalculates the bounds for the collection of items.
|
void |
setDomainDescription(java.lang.String description)
Sets the domain description and fires a property change event (with the
property name
Domain if the description changes). |
void |
setRangeDescription(java.lang.String description)
Sets the range description and fires a property change event with the
name
Range. |
void |
update(int index,
java.lang.Number value)
Updates (changes) the value of a data item and sends a
SeriesChangeEvent to all registered listeners. |
private void |
updateBounds(TimePeriod period,
int index)
Update the index values for the maximum and minimum bounds.
|
addChangeListener, addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireSeriesChanged, fireVetoableChange, getDescription, getKey, getNotify, isEmpty, notifyListeners, removeChangeListener, removePropertyChangeListener, removeVetoableChangeListener, setDescription, setKey, setNotifystatic final long serialVersionUID
protected static final java.lang.String DEFAULT_DOMAIN_DESCRIPTION
protected static final java.lang.String DEFAULT_RANGE_DESCRIPTION
private java.lang.String domain
private java.lang.String range
private java.util.List data
private int minStartIndex
private int maxStartIndex
private int minMiddleIndex
private int maxMiddleIndex
private int minEndIndex
private int maxEndIndex
public TimePeriodValues(java.lang.String name)
name - the name of the series (null not permitted).public TimePeriodValues(java.lang.String name,
java.lang.String domain,
java.lang.String range)
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.range - the range description.public java.lang.String getDomainDescription()
null).getRangeDescription(),
setDomainDescription(String)public void setDomainDescription(java.lang.String description)
Domain if the description changes).description - the new description (null permitted).getDomainDescription()public java.lang.String getRangeDescription()
null).getDomainDescription(),
setRangeDescription(String)public void setRangeDescription(java.lang.String description)
Range.description - the new description (null permitted).getRangeDescription()public int getItemCount()
getItemCount in class Seriespublic TimePeriodValue getDataItem(int index)
index - the item index (in the range 0 to
getItemCount() - 1).public TimePeriod getTimePeriod(int index)
index - the item index (in the range 0 to
getItemCount() - 1).getDataItem(int)public java.lang.Number getValue(int index)
index - the item index (in the range 0 to
getItemCount() - 1).null).getDataItem(int)public void add(TimePeriodValue item)
SeriesChangeEvent to
all registered listeners.item - the item (null not permitted).private void updateBounds(TimePeriod period, int index)
period - the time period.index - the index of the time period.private void recalculateBounds()
public void add(TimePeriod period, double value)
SeriesChangeEvent
to all registered listeners.period - the time period (null not permitted).value - the value.add(TimePeriod, Number)public void add(TimePeriod 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(int index,
java.lang.Number value)
SeriesChangeEvent to all registered listeners.index - the index of the data item to update.value - the new value (null not permitted).public void delete(int start,
int end)
SeriesChangeEvent to all registered listeners.start - the index of the first period to delete.end - the index of the last period to delete.public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
Notes:
public TimePeriodValues createCopy(int start, int end) throws java.lang.CloneNotSupportedException
start - the index of the first item to copy.end - the index of the last item to copy.java.lang.CloneNotSupportedException - if there is a cloning problem.public int getMinStartIndex()
public int getMaxStartIndex()
public int getMinMiddleIndex()
public int getMaxMiddleIndex()
public int getMinEndIndex()
public int getMaxEndIndex()