Class MovingAverage


  • public class MovingAverage
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MovingAverage()
      Creates a moving average over the last 5 values.
      MovingAverage​(int n)
      Creates a moving average over the last N values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getAverage()  
      <T extends java.lang.Number>
      void
      update​(T amount)  
      • Methods inherited from class java.lang.Object

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

      • MovingAverage

        public MovingAverage()
        Creates a moving average over the last 5 values.
      • MovingAverage

        public MovingAverage​(int n)
        Creates a moving average over the last N values.
        Parameters:
        n - last N values to average.
    • Method Detail

      • update

        public <T extends java.lang.Number> void update​(T amount)
      • getAverage

        public double getAverage()