|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.android.activityminer.logic.util.AbstractActivatableComponentImpl
org.android.activityminer.model.timeseries.SensorObservationCache<T,U>
T - the enumeration type for the dimensionsU - the data type for the dimension valuespublic class SensorObservationCache<T extends Enum<T> & Dimensions,U>
Cache for sensor observations.
| Field Summary | |
|---|---|
protected ConcurrentLinkedQueue<SensorObservation<T,U>> |
cache
The sample cache. |
private SensorObservation<T,U> |
lastObservation
The last scanned sensor observation. |
private long |
lastObservationOrgTs
Last observation original time stamp. |
private long |
maxToleratedGap
The maximum tolerated gap for samples before an error notification is fired |
| Constructor Summary | |
|---|---|
SensorObservationCache()
Constructor |
|
| Method Summary | |
|---|---|
void |
add(SensorObservation<T,U> observation)
Does add a new observation to the cache. |
boolean |
isEmpty()
Checks if is empty. |
protected void |
onActivationStateChange(boolean active)
Handler for activation state changes |
void |
onDestroy()
This method is for cleanup in case of termination. |
List<SensorObservation<T,U>> |
removeObservations()
Does remove and returns all observations in the cache. |
SensorObservation<T,U> |
takeSample(Long ts)
Getter for the current sample |
| Methods inherited from class org.android.activityminer.logic.util.AbstractActivatableComponentImpl |
|---|
isActive, setActivationState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final long maxToleratedGap
private SensorObservation<T extends Enum<T> & Dimensions,U> lastObservation
private long lastObservationOrgTs
protected final ConcurrentLinkedQueue<SensorObservation<T extends Enum<T> & Dimensions,U>> cache
| Constructor Detail |
|---|
public SensorObservationCache()
| Method Detail |
|---|
public SensorObservation<T,U> takeSample(Long ts)
SensorDataSource
takeSample in interface SensorDataSource<SensorObservation<T extends Enum<T> & Dimensions,U>>ts - the requested time stamp
public final boolean isEmpty()
public List<SensorObservation<T,U>> removeObservations()
public final void add(SensorObservation<T,U> observation)
observation - the observation to addpublic void onDestroy()
SensorDataSource
onDestroy in interface SensorDataSource<SensorObservation<T extends Enum<T> & Dimensions,U>>protected void onActivationStateChange(boolean active)
AbstractActivatableComponentImpl
onActivationStateChange in class AbstractActivatableComponentImplactive - the new activation state
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||