Class RunningAverage

java.lang.Object
com.biglybt.core.util.average.RunningAverage
All Implemented Interfaces:
Average

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

    Fields
    Modifier and Type
    Field
    Description
    private long
     
    private double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new running average.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Return average-so-far.
    void
    sets back to start-of-day
    double
    update(double newValue)
    Update average and return average-so-far.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • count

      private long count
    • sum

      private double sum
  • Constructor Details

    • RunningAverage

      public RunningAverage()
      Create a new running average.
  • Method Details

    • reset

      public void reset()
      Description copied from interface: Average
      sets back to start-of-day
      Specified by:
      reset in interface Average
    • update

      public double update(double newValue)
      Update average and return average-so-far.
      Specified by:
      update in interface Average
    • getAverage

      public double getAverage()
      Return average-so-far.
      Specified by:
      getAverage in interface Average