Class RingBufferMath


  • public class RingBufferMath
    extends java.lang.Object
    Utility class for calculating averages on the last N values, with input and output transformers.
    • Constructor Summary

      Constructors 
      Constructor Description
      RingBufferMath​(int size, java.util.function.Function<java.lang.Double,​java.lang.Double> inputProcessor, java.util.function.Function<java.lang.Double,​java.lang.Double> outputProcessor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(double value)  
      double mean()  
      • Methods inherited from class java.lang.Object

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

      • RingBufferMath

        public RingBufferMath​(int size,
                              java.util.function.Function<java.lang.Double,​java.lang.Double> inputProcessor,
                              java.util.function.Function<java.lang.Double,​java.lang.Double> outputProcessor)
        Parameters:
        size - Maximum number of values to remember.
        inputProcessor - Input transformer.
        outputProcessor - Output transformer.
    • Method Detail

      • add

        public void add​(double value)
        Parameters:
        value - Original value to add (before transformation)
      • mean

        public double mean()
        Returns:
        Transformed mean of the internal values.