edu.jhu.ece.iacl.jist.pipeline
Class CalculationMonitor

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.CalculationMonitor
All Implemented Interfaces:
java.lang.Runnable

public class CalculationMonitor
extends java.lang.Object
implements java.lang.Runnable

Monitor a calculation during its execution.

Author:
Blake Lucas

Constructor Summary
CalculationMonitor(ProcessingAlgorithm algo, ViewJProgressBar progressBar)
          Default constructor with algorithm and progress bar.
CalculationMonitor(ProcessingAlgorithm algo, ViewJProgressBar progressBar, AbstractCalculation calc)
          Default constructor with progress bar, observable calculation, and algorithm.
 
Method Summary
 PerformanceSummary getPerformance()
          Get summary of performance.
 long getTimeStamp()
          Get time stamp in milliseconds.
 void observe(AbstractCalculation calc)
          Start observing a calculation.
 void run()
          Periodically poll the algorithm to determine its current progress.
 void setObservableCalculation(AbstractCalculation calc)
          Set root calculation for this monitor.
static void setPollInterval(long interval)
          Set interval at which the algorithm is polled.
 void start()
          Start calculation monitor.
 void stop()
          Stop progress monitoring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalculationMonitor

public CalculationMonitor(ProcessingAlgorithm algo,
                          ViewJProgressBar progressBar)
Default constructor with algorithm and progress bar.

Parameters:
algo - the algorithm
progressBar - the progress bar

CalculationMonitor

public CalculationMonitor(ProcessingAlgorithm algo,
                          ViewJProgressBar progressBar,
                          AbstractCalculation calc)
Default constructor with progress bar, observable calculation, and algorithm.

Parameters:
progressBar - progress bar
calc - algorithm to monitor
algo - the algorithm
Method Detail

setPollInterval

public static void setPollInterval(long interval)
Set interval at which the algorithm is polled. The default is 3 seconds.

Parameters:
interval - Poll interval in milliseconds

getPerformance

public PerformanceSummary getPerformance()
Get summary of performance. Marks all calculations as completed if they have not been marked previously.

Returns:
the performance

getTimeStamp

public long getTimeStamp()
Get time stamp in milliseconds.

Returns:
time in milliseconds

observe

public void observe(AbstractCalculation calc)
Start observing a calculation.

Parameters:
calc - the calculation

run

public void run()
Periodically poll the algorithm to determine its current progress.

Specified by:
run in interface java.lang.Runnable

setObservableCalculation

public void setObservableCalculation(AbstractCalculation calc)
Set root calculation for this monitor.

Parameters:
calc - the calculation

start

public void start()
Start calculation monitor.


stop

public void stop()
Stop progress monitoring.