FileDocCategorySizeDatePackage
RunningAverage.javaAPI DocAzureus 3.0.3.41599Tue Mar 21 15:01:34 GMT 2006com.aelitis.azureus.core.util.average

RunningAverage

public class RunningAverage extends Object implements Average
Implements a simple running average.

Fields Summary
private long
count
private double
sum
Constructors Summary
public RunningAverage()
Create a new running average.

   
            
     
      this.sum = 0;
   
Methods Summary
public doublegetAverage()
Return average-so-far.

 return sum / count; 
public voidreset()

		count = 0;
		sum = 0;
	
public doubleupdate(double newValue)
Update average and return average-so-far.

      sum += newValue;
      count++;
      return sum / count;