Package adams.data.timeseries
Class TimeseriesPoint
- java.lang.Object
-
- adams.data.container.AbstractDataPoint
-
- adams.data.timeseries.TimeseriesPoint
-
- All Implemented Interfaces:
CloneHandler
,DataPoint
,Serializable
,Comparable
public class TimeseriesPoint extends AbstractDataPoint
Encapsulates a single data point of a timeseries.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static DateFormat
m_DateFormat
for formatting dates.protected Date
m_Timestamp
the teimstamp of the data point.protected double
m_Value
the timeseries value.-
Fields inherited from class adams.data.container.AbstractDataPoint
m_Parent
-
-
Constructor Summary
Constructors Constructor Description TimeseriesPoint()
Initializes the point with the current date and 0.0 value.TimeseriesPoint(Date timestamp, double value)
Initializes the point with the specified timestamp and value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(DataPoint other)
Obtains the stored variables from the other data point.int
compareTo(Object o)
Compares this object with the specified object for order.protected DateFormat
getDateFormat()
Returns the formatter for the timestamps.Date
getTimestamp()
Returns the timestamp.double
getValue()
Returns the value.void
setTimestamp(Date value)
Sets the timestamp.void
setValue(double value)
Sets the value.String
toString()
Returns a string representation of the point.
-
-
-
Field Detail
-
m_DateFormat
protected static DateFormat m_DateFormat
for formatting dates.
-
m_Timestamp
protected Date m_Timestamp
the teimstamp of the data point.
-
m_Value
protected double m_Value
the timeseries value.
-
-
Constructor Detail
-
TimeseriesPoint
public TimeseriesPoint()
Initializes the point with the current date and 0.0 value.
-
TimeseriesPoint
public TimeseriesPoint(Date timestamp, double value)
Initializes the point with the specified timestamp and value.- Parameters:
timestamp
- the date of the data pointvalue
- the value of the data point
-
-
Method Detail
-
getDateFormat
protected DateFormat getDateFormat()
Returns the formatter for the timestamps.- Returns:
- the formatter
-
setTimestamp
public void setTimestamp(Date value)
Sets the timestamp.- Parameters:
value
- the timestamp
-
getTimestamp
public Date getTimestamp()
Returns the timestamp.- Returns:
- the timestamp
-
setValue
public void setValue(double value)
Sets the value.- Parameters:
value
- the value
-
getValue
public double getValue()
Returns the value.- Returns:
- the value
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only uses the timestamp for comparison.- Specified by:
compareTo
in interfaceComparable
- Specified by:
compareTo
in classAbstractDataPoint
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
assign
public void assign(DataPoint other)
Obtains the stored variables from the other data point.- Specified by:
assign
in interfaceDataPoint
- Overrides:
assign
in classAbstractDataPoint
- Parameters:
other
- the data point to get the values from
-
toString
public String toString()
Returns a string representation of the point.- Specified by:
toString
in classAbstractDataPoint
- Returns:
- the string representation
-
-