|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.bonzoun.cocodonkey.RateCalculator
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 | |
(package private) class |
RateCalculator.RateKeeper
|
Constructor Summary | |
RateCalculator()
|
Method Summary | |
void |
addRate(float rate)
|
float |
meanRate()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RateCalculator()
Method Detail |
public void addRate(float rate)
public float meanRate()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |