org.android.activityminer.logic.features
Class AbstractCutoutFeatureExtractor<T extends Enum<T> & Dimensions>

Package class diagram package AbstractCutoutFeatureExtractor
java.lang.Object
  extended by java.lang.Thread
      extended by de.unikassel.android.sdcframework.util.AbstractWorkerThread
          extended by de.unikassel.android.sdcframework.util.AbstractEventDispatcherImpl<SensorObservationCutout<T,Double>,FeatureVector>
              extended by org.android.activityminer.logic.features.AbstractFeatureExtractor<T>
                  extended by org.android.activityminer.logic.features.AbstractCutoutFeatureExtractor<T>
Type Parameters:
T - the enumeration type for the dimensions
All Implemented Interfaces:
EventDispatcher<SensorObservationCutout<T,Double>,FeatureVector>, ObservableEventSource<FeatureVector>, ObserverRegistration<FeatureVector>, WorkerThread, Runnable, ActivatableComponent
Direct Known Subclasses:
AbstractFeatureExtractorForDBRecordings

public abstract class AbstractCutoutFeatureExtractor<T extends Enum<T> & Dimensions>
extends AbstractFeatureExtractor<T>

The cut/out feature extractor is a feature extractor with an integrated cut-out creator component ObservableCutoutCreator, which is connected to its own in port for sensor observation cut-outs.

In general activation state is delegated to internal components. On activation, the cut-out creator is attached to an observable sensor observation source which must be provided during construction.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  Context context
          The context.
private  GenericObservableCutoutCreator<T,Double> cutoutSource
          The creator for the sensor observation cut-outs to extract features from.
 
Fields inherited from class de.unikassel.android.sdcframework.util.AbstractEventDispatcherImpl
collector
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractCutoutFeatureExtractor(long windowSize, int overlap, FeatureTypes[] featureTypes, long sampleRate, Context context)
          Constructor
 
Method Summary
 void attachSensorObservationSource(ObservableEventSource<SensorObservation<T,Double>> sensorObservationSource)
          Method to attach a source for sensor observations.
 void detachSensorObservationSource(ObservableEventSource<SensorObservation<T,Double>> sensorObservationSource)
          Method to detach from a source for sensor observations.
protected  GenericObservableCutoutCreator<T,Double> getCutoutSource()
          Getter for the cutoutSource
 int getOverlapSize()
          Getter for the milliseconds by which a cut-out will overlap with the previous one.
protected  int getQueuedObservationCount()
          Getter for the remaining count of unprocessed observations.
 long getWindowSize()
          Getter for the fixed size of window used to extract cut-outs from the observed sensor observations.
protected  void onActivationStateChange(boolean active)
          Handler for activation state changes
 void onDestroy()
          Destruction.
 void setWindowSize(int windowSize)
          Setter for the sliding window size used to extract cut-outs.
 
Methods inherited from class org.android.activityminer.logic.features.AbstractFeatureExtractor
doWork, featureTypeConfiguration, getExtractionTime, getFactory, getQueuedCutoutCount, isActive, isEctracting, setActivationState
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractEventDispatcherImpl
doCleanUp, getCollector, getEventSource, hasObservers, notify, registerEventObserver, removeAllObservers, unregisterEventObserver
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractWorkerThread
doTerminate, hasTerminated, isLogging, isWorking, logMessage, run, setLogging, start, startWork, stopWork
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObservableEventSource
hasObservers, notify
 
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObserverRegistration
registerEventObserver, removeAllObservers, unregisterEventObserver
 
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.WorkerThread
doTerminate, hasTerminated, isLogging, isWorking, setLogging, startWork, stopWork
 

Field Detail

cutoutSource

private final GenericObservableCutoutCreator<T extends Enum<T> & Dimensions,Double> cutoutSource
The creator for the sensor observation cut-outs to extract features from.


context

private Context context
The context.

Constructor Detail

AbstractCutoutFeatureExtractor

public AbstractCutoutFeatureExtractor(long windowSize,
                                      int overlap,
                                      FeatureTypes[] featureTypes,
                                      long sampleRate,
                                      Context context)
Constructor

Parameters:
windowSize - the size of the window to extract features from, which is moved over the raw time series stream
overlap - the overlap in percent of continuous cut-outs
featureTypes - the types of the features to extract from the time series data
sampleRate - the configured sample rate
context - the context
Method Detail

getCutoutSource

protected GenericObservableCutoutCreator<T,Double> getCutoutSource()
Getter for the cutoutSource

Returns:
the cutoutSource

onActivationStateChange

protected void onActivationStateChange(boolean active)
Description copied from class: AbstractFeatureExtractor
Handler for activation state changes

Overrides:
onActivationStateChange in class AbstractFeatureExtractor<T extends Enum<T> & Dimensions>
Parameters:
active - the new activation state

getWindowSize

public final long getWindowSize()
Getter for the fixed size of window used to extract cut-outs from the observed sensor observations.

Returns:
the window size

setWindowSize

public final void setWindowSize(int windowSize)
Setter for the sliding window size used to extract cut-outs.

Parameters:
windowSize - the window size to set

getOverlapSize

public final int getOverlapSize()
Getter for the milliseconds by which a cut-out will overlap with the previous one.

Returns:
the overlap size

onDestroy

public final void onDestroy()
Destruction.

Overrides:
onDestroy in class AbstractFeatureExtractor<T extends Enum<T> & Dimensions>

getQueuedObservationCount

protected final int getQueuedObservationCount()
Getter for the remaining count of unprocessed observations.

Returns:
the remaining count of unprocessed observations

attachSensorObservationSource

public final void attachSensorObservationSource(ObservableEventSource<SensorObservation<T,Double>> sensorObservationSource)
Method to attach a source for sensor observations.

Parameters:
sensorObservationSource - the source for sensor observations to attach to

detachSensorObservationSource

public final void detachSensorObservationSource(ObservableEventSource<SensorObservation<T,Double>> sensorObservationSource)
Method to detach from a source for sensor observations.

Parameters:
sensorObservationSource - the source for sensor observations to detach from