edu.wpi.prc.example.java.science
Class ComputeThread

java.lang.Object
  extended by java.lang.Thread
      extended by edu.wpi.prc.example.java.science.ComputeThread
All Implemented Interfaces:
java.lang.Runnable

public class ComputeThread
extends java.lang.Thread

The ComputeThread runs the science algorithm (from ScienceDataProcessor) in a low-priority thread.

Author:
James Baldassari

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  byte[] result
           
private  byte[] workUnit
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ComputeThread(byte[] workUnit)
          Constructor that takes the work unit data.
 
Method Summary
 byte[] getResult()
           
 void run()
          Invokes the ScienceDataProcessor to compute the result for the current work unit.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

workUnit

private byte[] workUnit

result

private byte[] result
Constructor Detail

ComputeThread

public ComputeThread(byte[] workUnit)
Constructor that takes the work unit data.

Parameters:
workUnit - The work unit data to be processed.
Method Detail

run

public void run()
Invokes the ScienceDataProcessor to compute the result for the current work unit.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getResult

public byte[] getResult()
Returns:
Returns the result computed by the science algorithm.