Home » openjdk-7 » net.bonzoun » cocodonkey » [javadoc | source]
public class: RateCalculator [javadoc | source]
This class is intended to calculate a remaining time for a download. For that, it uses instant download rates and makes complicated averages on them to finally get a better approximation of the remaining time than what the instant download rate can give. A first calculation is done with a floating average of the rate on a one minute length (MINUTE_LENGTH*MINUTE_PRECISION gives the length of a minute for the calculation, the unite being the second). A second estimation uses a one hour length for the floating average (one hour is HOUR_LENGTH*HOUR_PRECISION long, the unite being the second). The best of these two calculations is supposed to be the best bet for the current rate. The addRate() method is used to add a rate. It can be called as often as possible as the current class only uses the required data (MINUTE_PRECISION determines the amount of data that will be retained).
Nested Class Summary:
class  RateCalculator.RateKeeper   
 public RateCalculator() 
Method from net.bonzoun.cocodonkey.RateCalculator Summary:
addRate,   meanRate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from net.bonzoun.cocodonkey.RateCalculator Detail:
 public  void addRate(float rate) 
 public float meanRate()