Class AbstractStatistics.SMA

java.lang.Object
org.datanucleus.management.AbstractStatistics.SMA
Enclosing class:
AbstractStatistics

public static class AbstractStatistics.SMA extends Object
Simple Moving Average
  • Field Details

    • values

      private LinkedList<Double> values
    • length

      private int length
    • sum

      private double sum
    • average

      private double average
  • Constructor Details

    • SMA

      public SMA(int length)
      Parameters:
      length - the maximum length
  • Method Details

    • currentAverage

      public double currentAverage()
    • compute

      public double compute(double value)
      Compute the moving average. Synchronised so that no changes in the underlying data is made during calculation.
      Parameters:
      value - The value
      Returns:
      The average