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.
add
public void add(TimePeriod period,
Number value)
Adds a new data item to the series.
period
- the time period.value
- the value.
add
public void add(TimePeriod period,
double value)
Adds a new data item to the series.
period
- the time period.value
- the value.
add
public void add(TimePeriodValue item)
Adds a data item to the series.
item
- the (timeperiod, value) pair.
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).
- clone in interface Series
- A clone of the time series.
createCopy
public TimePeriodValues createCopy(int start,
int end)
throws CloneNotSupportedException
Creates a new instance by copying a subset of the data in this
collection.
start
- the index of the first item to copy.end
- the index of the last item to copy.
- A copy of a subset of the items.
delete
public void delete(int start,
int end)
Deletes data from start until end index (end inclusive).
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.
- equals in interface Series
getDataItem
public TimePeriodValue getDataItem(int index)
Returns one data item for the series.
index
- the item index (zero-based).
- One data item for the series.
getItemCount
public int getItemCount()
Returns the number of items in the series.
getMaxEndIndex
public int getMaxEndIndex()
Returns the index of the time period with the maximum end milliseconds.
getMaxMiddleIndex
public int getMaxMiddleIndex()
Returns the index of the time period with the maximum middle
milliseconds.
getMaxStartIndex
public int getMaxStartIndex()
Returns the index of the time period with the maximum start milliseconds.
getMinEndIndex
public int getMinEndIndex()
Returns the index of the time period with the minimum end milliseconds.
getMinMiddleIndex
public int getMinMiddleIndex()
Returns the index of the time period with the minimum middle
milliseconds.
getMinStartIndex
public int getMinStartIndex()
Returns the index of the time period with the minimum start milliseconds.
getTimePeriod
public TimePeriod getTimePeriod(int index)
Returns the time period at the specified index.
index
- the index of the data pair.
- The time period at the specified index.
getValue
public Number getValue(int index)
Returns the value at the specified index.
index
- index of a value.
- The value at the specified index.
setDomainDescription
public void setDomainDescription(String description)
Sets the domain description and fires a property change event.
description
- the new description.
setRangeDescription
public void setRangeDescription(String description)
Sets the range description and fires a property change event.
description
- the new description.
update
public void update(int index,
Number value)
Updates (changes) the value of a data item.
index
- the index of the data item to update.value
- the new value.