net.spy.util
Class ProgressStats

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

public class ProgressStats
extends java.lang.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.
 java.lang.String getStats()
          Get a string representation of the processing statistics using the default format.
 java.lang.String getStats(java.lang.String format)
          Get a string representation fo the processing statistics.
 void start()
          Mark us having started processing something.
 void stop()
          Mark this iteration as complete.
 java.lang.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

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 java.lang.String getStats(java.lang.String format)
Get a string representation fo the processing statistics.

The following arguments are available to this format string.


getStats

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


toString

public java.lang.String toString()
String me.

Overrides:
toString in class java.lang.Object
Returns:
getStats()


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