org.android.activityminer.logic.features.selection
Class FeatureSelectionThread

Package class diagram package FeatureSelectionThread
java.lang.Object
  extended by java.lang.Thread
      extended by de.unikassel.android.sdcframework.util.AbstractWorkerThread
          extended by org.android.activityminer.app.util.ObservableWorkerThreadWithProgressNotification
              extended by org.android.activityminer.logic.features.selection.FeatureSelectionThread
All Implemented Interfaces:
EventObserver<ObservableProgressData>, ObservableEventSource<TaskFinishedEvent>, ObserverRegistration<TaskFinishedEvent>, WorkerThread, Runnable

public class FeatureSelectionThread
extends ObservableWorkerThreadWithProgressNotification
implements EventObserver<ObservableProgressData>

The feature selection thread.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  Context context
          The context.
private  double elapsedTime
          The time needed for the evaluation run.
private  int FEATURE_SELECTION_NOTIFICATION
          the notification identifier
private  FeatureSelectionHelper helper
          The evaluation helper to delegate to
private  long startTime
          The start time of the actual evaluation run.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FeatureSelectionThread(Context context, DBManager dbManager, Set<FeatureTypes> featureSet, Configuration config, int size, Class<? extends Activity> intentReceiver)
          Constructor
 
Method Summary
static FeatureSelectionThread createAndRun(Context context, DBManager dbManager, Set<FeatureTypes> featureSet, Configuration config, int size, EventObserver<TaskFinishedEvent> finishedObserver, Class<? extends Activity> intentReceiver)
          Does create and execute an evaluation thread for the given configuration and feature sets.
protected  void doWork()
           
 String getErrorNotificationMsg()
          Getter for the error notification message
protected  String getEvaluationStorageLocation()
          Getter for the save file name and path
 int getNotificationId()
          Getter for the notification identifier
 String getResultNotificationMsg()
          Getter for the result notification message
 boolean hasSucceeded()
          Test method for success in case of termination
 void onEvent(ObservableEventSource<? extends ObservableProgressData> eventSource, ObservableProgressData observedEvent)
           
 
Methods inherited from class org.android.activityminer.app.util.ObservableWorkerThreadWithProgressNotification
broadcastProgress, doCleanUp, getApplicationContext, getFinalResult, getMaxProgress, getNotification, getTaskTitle, hasObservers, incrementAndNotifyProgress, incrementAndNotifyProgress, notify, notifyProgress, notifyProgress, registerEventObserver, removeAllObservers, setMaxProgress, 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
 

Field Detail

FEATURE_SELECTION_NOTIFICATION

private int FEATURE_SELECTION_NOTIFICATION
the notification identifier


helper

private final FeatureSelectionHelper helper
The evaluation helper to delegate to


startTime

private long startTime
The start time of the actual evaluation run.


elapsedTime

private double elapsedTime
The time needed for the evaluation run.


context

private final Context context
The context.

Constructor Detail

FeatureSelectionThread

public FeatureSelectionThread(Context context,
                              DBManager dbManager,
                              Set<FeatureTypes> featureSet,
                              Configuration config,
                              int size,
                              Class<? extends Activity> intentReceiver)
Constructor

Parameters:
context - the application context
dbManager - a reference to the database manager
config - the current configuration
featureSet - the set with the features to search in
size - the subset size
intentReceiver - the intent receiver class
Method Detail

doWork

protected void doWork()
Specified by:
doWork in class AbstractWorkerThread

getResultNotificationMsg

public String getResultNotificationMsg()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the result notification message

Specified by:
getResultNotificationMsg in class ObservableWorkerThreadWithProgressNotification
Returns:
the result notification message

getErrorNotificationMsg

public String getErrorNotificationMsg()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the error notification message

Specified by:
getErrorNotificationMsg in class ObservableWorkerThreadWithProgressNotification
Returns:
the error notification message

hasSucceeded

public boolean hasSucceeded()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Test method for success in case of termination

Specified by:
hasSucceeded in class ObservableWorkerThreadWithProgressNotification
Returns:
true if thread has successfully finished it's task, false in case of errors

getNotificationId

public int getNotificationId()
Description copied from class: ObservableWorkerThreadWithProgressNotification
Getter for the notification identifier

Specified by:
getNotificationId in class ObservableWorkerThreadWithProgressNotification
Returns:
the notification identifier

getEvaluationStorageLocation

protected final String getEvaluationStorageLocation()
Getter for the save file name and path

Returns:
the save file name and path

createAndRun

public static final FeatureSelectionThread createAndRun(Context context,
                                                        DBManager dbManager,
                                                        Set<FeatureTypes> featureSet,
                                                        Configuration config,
                                                        int size,
                                                        EventObserver<TaskFinishedEvent> finishedObserver,
                                                        Class<? extends Activity> intentReceiver)
Does create and execute an evaluation thread for the given configuration and feature sets.

Parameters:
context - the context of the caller
dbManager - the database manager to use
config - the configuration to use
featureSet - the set with the features to search in
size - the subset size
finishedObserver - the finished event observer
intentReceiver - the intent receiver class
Returns:
the created evaluation thread

onEvent

public void onEvent(ObservableEventSource<? extends ObservableProgressData> eventSource,
                    ObservableProgressData observedEvent)
Specified by:
onEvent in interface EventObserver<ObservableProgressData>