public class TimeSeriesDataItem extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
The time period can be any of the following:
The time period is an immutable property of the data item. Data items will often be sorted within a list, and allowing the time period to be changed could destroy the sort order.
Implements the Comparable
interface so that standard Java
sorting can be used to keep the data items in order.
Constructor and Description |
---|
TimeSeriesDataItem(RegularTimePeriod period,
double value)
Constructs a new data item that associates a value with a time period.
|
TimeSeriesDataItem(RegularTimePeriod period,
java.lang.Number value)
Constructs a new data item that associates a value with a time period.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones the data item.
|
int |
compareTo(java.lang.Object o1)
Returns an integer indicating the order of this data pair object
relative to another object.
|
boolean |
equals(java.lang.Object obj)
Tests this object for equality with an arbitrary object.
|
RegularTimePeriod |
getPeriod()
Returns the time period.
|
java.lang.Number |
getValue()
Returns the value.
|
int |
hashCode()
Returns a hash code.
|
void |
setValue(java.lang.Number value)
Sets the value for this data item.
|
public TimeSeriesDataItem(RegularTimePeriod period, java.lang.Number value)
period
- the time period (null
not permitted).value
- the value (null
permitted).public TimeSeriesDataItem(RegularTimePeriod period, double value)
period
- the time period (null
not permitted).value
- the value associated with the time period.public RegularTimePeriod getPeriod()
null
).public java.lang.Number getValue()
null
possible).setValue(java.lang.Number)
public void setValue(java.lang.Number value)
value
- the value (null
permitted).getValue()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other object (null
permitted).public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object o1)
For the order we consider only the timing: negative == before, zero == same, positive == after.
compareTo
in interface java.lang.Comparable
o1
- The object being compared to.public java.lang.Object clone()
clone
in class java.lang.Object