org.android.activityminer.model.timeseries
Class AbstractSensorObservation<T extends Enum<T> & Dimensions>

Package class diagram package AbstractSensorObservation
java.lang.Object
  extended by org.android.activityminer.model.timeseries.AbstractSensorObservation<T>
Type Parameters:
T - the enumeration type for the dimensions
All Implemented Interfaces:
ObservableEvent, DeviceData, SensorObservation<T,Double>
Direct Known Subclasses:
AccSensorObservationImpl, SensorObservationImpl

public abstract class AbstractSensorObservation<T extends Enum<T> & Dimensions>
extends Object
implements SensorObservation<T,Double>

The abstract base implementation for sensor observations.


Field Summary
 Long ts
          The sample time stamp.
protected  Double[] values
          The sample data vector.
 
Constructor Summary
AbstractSensorObservation(Long ts, Double[] values)
          Constructor for serialization
 
Method Summary
 Double get(T dim)
          Getter for the value of a specific dimension
 Long getTimeStamp()
          Getter for the time stamp.
 Double[] getValues()
          Getter for the values.
 boolean hasEqualValues(SensorObservation<T,Double> observation)
          Test method for equal values
 void set(T dim, Double value)
          Setter for the value of a specific dimension
 void setTimeStamp(long ts)
          Setter for the time stamp.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.android.activityminer.model.timeseries.SensorObservation
cloneWithTimeStamp, getDimensions
 

Field Detail

ts

public Long ts
The sample time stamp.


values

protected final Double[] values
The sample data vector.

Constructor Detail

AbstractSensorObservation

public AbstractSensorObservation(Long ts,
                                 Double[] values)
Constructor for serialization

Parameters:
ts - the time stamp
values - the values
Method Detail

set

public final void set(T dim,
                      Double value)
Description copied from interface: SensorObservation
Setter for the value of a specific dimension

Specified by:
set in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Parameters:
dim - the dimension identifier
value - the value for the given dimension

get

public final Double get(T dim)
Description copied from interface: SensorObservation
Getter for the value of a specific dimension

Specified by:
get in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Parameters:
dim - the dimension identifier
Returns:
the value for the given dimension

getTimeStamp

public final Long getTimeStamp()
Description copied from interface: SensorObservation
Getter for the time stamp.

Specified by:
getTimeStamp in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Returns:
the time stamp in milliseconds

setTimeStamp

public void setTimeStamp(long ts)
Description copied from interface: SensorObservation
Setter for the time stamp.

Specified by:
setTimeStamp in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Parameters:
ts - the time stamp to set

getValues

public final Double[] getValues()
Description copied from interface: SensorObservation
Getter for the values.

Specified by:
getValues in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Returns:
the array with the values

hasEqualValues

public boolean hasEqualValues(SensorObservation<T,Double> observation)
Description copied from interface: SensorObservation
Test method for equal values

Specified by:
hasEqualValues in interface SensorObservation<T extends Enum<T> & Dimensions,Double>
Parameters:
observation - the sensor observation to compare values with
Returns:
true if values are equal, false other wise

toString

public String toString()
Overrides:
toString in class Object