Class MovingAverage

java.lang.Object
edu.berkeley.cs.jqf.fuzz.util.MovingAverage

public class MovingAverage extends Object
MovingAverage - A data structure for collecting a moving average.
Author:
Raffi Sanna
  • Constructor Summary

    Constructors
    Constructor
    Description
    MovingAverage(int cap)
    Constructs a moving average of the most recent cap arguments
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int a)
    Adds a number to the set of numbers used to find the moving average.
    double
    get()
    Gets the moving average itself, or 0 if nothing has been added.

    Methods inherited from class java.lang.Object

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

    • MovingAverage

      public MovingAverage(int cap)
      Constructs a moving average of the most recent cap arguments
      Parameters:
      cap - The number of elements to be remembered
  • Method Details

    • add

      public void add(int a)
      Adds a number to the set of numbers used to find the moving average.
      Parameters:
      a - The number to be added
    • get

      public double get()
      Gets the moving average itself, or 0 if nothing has been added.
      Returns:
      the moving average