stella.xml
Class ParsedTarget.RateThread

java.lang.Object
  extended by java.lang.Thread
      extended by stella.xml.ParsedTarget.RateThread
All Implemented Interfaces:
Runnable
Enclosing class:
ParsedTarget

private class ParsedTarget.RateThread
extends Thread

A thread that waits for an expression to be fulfilled, then queries its constraints and rates an observation as successful, if everthing is fulfilled. On thread exit, we add the pick to the database.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  ParameterClustering condition
          The parameters for evaluating our rating conditions.
private  List<Appointable.Constraint> fulfill
          The list of constraint that must be fulfilled to rate successful.
private  HistoryAware.Pick pick
          The pick we should update.
private  ExpressionEvaluator waitfor
          The expression that must become true for a rating to proceed.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
private ParsedTarget.RateThread(HistoryAware.Pick update, ParameterClustering set, ExpressionEvaluator canrate, List<Appointable.Constraint> rate)
          Constructs, but does not start the rating thread.
 
Method Summary
private  void exitAction(TargetDefinition target, HistoryAware.Pick pick)
          Always called at the end of the thread's lifetime.
 void run()
          Runs the rate thread.
 
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, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

condition

private ParameterClustering condition
The parameters for evaluating our rating conditions.


waitfor

private ExpressionEvaluator waitfor
The expression that must become true for a rating to proceed.


fulfill

private List<Appointable.Constraint> fulfill
The list of constraint that must be fulfilled to rate successful.


pick

private HistoryAware.Pick pick
The pick we should update.

Constructor Detail

ParsedTarget.RateThread

private ParsedTarget.RateThread(HistoryAware.Pick update,
                                ParameterClustering set,
                                ExpressionEvaluator canrate,
                                List<Appointable.Constraint> rate)
Constructs, but does not start the rating thread. The link to the target is provided via the containing instance. None of the arguments might be null.

Method Detail

run

public void run()
Runs the rate thread. If the pick is already false, we end immediately, otherwise we wait for the condition to become true. Then, we go through the list of all constraints and render the current pick a success or a failure. The last action before exiting is adding the pick to the database, if desired.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

exitAction

private void exitAction(TargetDefinition target,
                        HistoryAware.Pick pick)
Always called at the end of the thread's lifetime. If database-entry is desired, we add the probably updated pick now.