net.opentsdb.core
Interface DataPoint


public interface DataPoint

Represents a single data point.

Implementations of this interface aren't expected to be synchronized.


Method Summary
 double doubleValue()
          Returns the value of the this data point as a double.
 boolean isInteger()
          Tells whether or not the this data point is a value of integer type.
 long longValue()
          Returns the value of the this data point as a long.
 long timestamp()
          Returns the timestamp (in seconds) associated with this data point.
 double toDouble()
          Returns the value of the this data point as a double, even if it's a long.
 

Method Detail

timestamp

long timestamp()
Returns the timestamp (in seconds) associated with this data point.

Returns:
A strictly positive, 32 bit integer.

isInteger

boolean isInteger()
Tells whether or not the this data point is a value of integer type.

Returns:
true if the ith value is of integer type, false if it's of doubleing point type.

longValue

long longValue()
Returns the value of the this data point as a long.

Throws:
ClassCastException - if the isInteger() == false.

doubleValue

double doubleValue()
Returns the value of the this data point as a double.

Throws:
ClassCastException - if the isInteger() == true.

toDouble

double toDouble()
Returns the value of the this data point as a double, even if it's a long.

Returns:
When isInteger() == false, this method returns the same thing as doubleValue(). Otherwise, it returns the same thing as longValue()'s return value casted to a double.