bb.util
Class ProgressIndicator

java.lang.Object
  extended by bb.util.ProgressIndicator

public class ProgressIndicator
extends Object

Class that stores the amount of progress completed by some other process. When created (by calling begin), this class starts a new internal thread that mostly sleeps but wakes up periodicly and prints out the amount of progress. The external process is responsible for updating the amount of progress by calling setPercentCompleted.

This class is multithread safe: every public method is synchronized.

Author:
Brent Boyer

Nested Class Summary
private  class ProgressIndicator.StatusUpdater
           
 
Field Summary
private  double percentCompleted
           
private  ProgressIndicator.StatusUpdater statusUpdater
           
 
Constructor Summary
private ProgressIndicator()
           
 
Method Summary
static ProgressIndicator begin()
           
 void end()
           
 double getPercentCompleted()
           
 void setPercentCompleted(double percentCompleted)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statusUpdater

private final ProgressIndicator.StatusUpdater statusUpdater

percentCompleted

private double percentCompleted
Constructor Detail

ProgressIndicator

private ProgressIndicator()
Method Detail

begin

public static ProgressIndicator begin()

end

public void end()

getPercentCompleted

public double getPercentCompleted()

setPercentCompleted

public void setPercentCompleted(double percentCompleted)
                         throws IllegalArgumentException
Parameters:
percentCompleted - the percentage of the overall effort that has been completed; must be expressed decimally
Throws:
IllegalArgumentException - if percentCompleted < 0.0 or percentCompleted > 1.0