net.spy.util
Class ProgressStats

java.lang.Object
  extended by net.spy.util.ProgressStats

public class ProgressStats
extends Object

A simple class for keeping up with the progress of an operation.


Constructor Summary
ProgressStats(int size)
          Get an instance of ProgressStats to process the given number of things.
 
Method Summary
 double getEstimatedTimeRemaining()
          Get the estimated number of seconds remaining with the current average.
 double getEstimatedTimeRemaining(double avgProcessTime)
          Get the estimated number of seconds remaining with the given average time per unit.
 long getLastProcessTime()
          Get the number of milliseconds spent processing the last item.
 double getOverallAverage()
          Get the overall average.
 double getRunningAverage()
          Get the running average of the number of seconds spent processing.
 String getStats()
          Get a string representation of the processing statistics using the default format.
 String getStats(String format)
          Get a string representation fo the processing statistics.
protected  long getTime()
          Get the current time for this ProgressStats instance.
 void start()
          Mark us having started processing something.
 void stop()
          Mark this iteration as complete.
 String toString()
          String me.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressStats

public ProgressStats(int size)
Get an instance of ProgressStats to process the given number of things.

Method Detail

getTime

protected long getTime()
Get the current time for this ProgressStats instance. This exists as a test fixture, but if you want to do something more exciting with it, go right ahead.


start

public void start()
Mark us having started processing something.


stop

public void stop()
Mark this iteration as complete.


getRunningAverage

public double getRunningAverage()
Get the running average of the number of seconds spent processing.

Returns:
((avg * df) + v) / (df + 1)

getOverallAverage

public double getOverallAverage()
Get the overall average.


getEstimatedTimeRemaining

public double getEstimatedTimeRemaining(double avgProcessTime)
Get the estimated number of seconds remaining with the given average time per unit.


getEstimatedTimeRemaining

public double getEstimatedTimeRemaining()
Get the estimated number of seconds remaining with the current average.


getLastProcessTime

public long getLastProcessTime()
Get the number of milliseconds spent processing the last item.


getStats

public String getStats(String format)
Get a string representation fo the processing statistics.

The following arguments are available to this format string.


getStats

public String getStats()
Get a string representation of the processing statistics using the default format.


toString

public String toString()
String me.

Overrides:
toString in class Object
Returns:
getStats()


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.