org.hackystat.telemetry.analyzer.model
Class TelemetryStream

java.lang.Object
  extended by org.hackystat.telemetry.analyzer.model.TelemetryStream

public class TelemetryStream
extends java.lang.Object

Represents a single telemetry stream, which contains an ordered series of TelemetryDataPoint instances.

Author:
(Cedric) Qin Zhang

Constructor Summary
TelemetryStream(java.lang.Object tag)
          Constructs this instance.
 
Method Summary
 void addDataPoint(TelemetryDataPoint dataPoint)
          Adds a data point to this telemetry stream.
 java.util.List<TelemetryDataPoint> getDataPoints()
          Gets a list of data points in this telemetry stream, ordered by time period.
 java.lang.Number getDataPointValue(org.hackystat.utilities.time.period.TimePeriod timePeriod)
          Gets the value associated with the specified time period.
 java.lang.Object getTag()
          Gets the tag associated with this telemetry stream.
 void setTag(java.lang.Object tag)
          Sets the tag associated with this telemetry stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TelemetryStream

public TelemetryStream(java.lang.Object tag)
Constructs this instance.

Parameters:
tag - An object that helps to recognize this telemetry stream. Null is a valid value.
Method Detail

getTag

public java.lang.Object getTag()
Gets the tag associated with this telemetry stream.

Returns:
The tag object.

setTag

public void setTag(java.lang.Object tag)
Sets the tag associated with this telemetry stream.

Parameters:
tag - The new tag value

addDataPoint

public void addDataPoint(TelemetryDataPoint dataPoint)
                  throws TelemetryDataModelException
Adds a data point to this telemetry stream. Note that the time period in all data points must be of the same type (either day, week, or month). Otherwise, an exception will be raised.

Parameters:
dataPoint - The data point to be added.
Throws:
TelemetryDataModelException - If the data for the time period already exists.

getDataPointValue

public java.lang.Number getDataPointValue(org.hackystat.utilities.time.period.TimePeriod timePeriod)
                                   throws TelemetryDataModelException
Gets the value associated with the specified time period. Note that if this telemetry stream does not contain the data point associated the time period, an exception is raised. If a null is return, it means that this streams contains the data point, but the value in that data point is null.

Parameters:
timePeriod - The time period.
Returns:
The value.
Throws:
TelemetryDataModelException - If there is no value associated with the time period.

getDataPoints

public java.util.List<TelemetryDataPoint> getDataPoints()
Gets a list of data points in this telemetry stream, ordered by time period.

Returns:
A collection of TelemetryDataPoint objects.