Class StatisticsAccumulator


  • public class StatisticsAccumulator
    extends java.lang.Object

    • Constructor Summary

      Constructors 
      Constructor Description
      StatisticsAccumulator​(java.lang.String unit)
      Construct the Statistics Accumulator by providing the unit as a String.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void augment​(StatisticsAccumulator acc)  
      double average()  
      void clearState()
      Clears the samples and starts fresh on new samples.
      long count()  
      Statistics getStats()  
      java.lang.String getValue()
      Computes the Standard Statistic Results based on the samples collected so far and provides the complete value as a formatted String
      double max()  
      double min()  
      void sample​(double value)  
      double standardDeviation()  
      java.lang.String toString()
      Users can extend StatisticsAccumulator to provide the complete Stats in the format they prefer, if the default format doesn't suffice.
      java.lang.String unit()  
      void unitTestValidate​(java.lang.String expectedUnit, double expectedMin, double expectedMax, long expectedSampleCount, double expectedAverage, double expectedStandardDeviation)
      This is an internal API to test StatisticsAccumulator...
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • max

        private double max
      • min

        private double min
      • sampleSum

        double sampleSum
      • sampleSquareSum

        double sampleSquareSum
      • sampleCount

        private long sampleCount
      • unit

        private java.lang.String unit
    • Constructor Detail

      • StatisticsAccumulator

        public StatisticsAccumulator​(java.lang.String unit)
        Construct the Statistics Accumulator by providing the unit as a String. The examples of units are "Hours", "Minutes", "Seconds", "MilliSeconds", "Micro Seconds" etc.,

        Parameters:
        unit - a String representing the units for the samples collected
    • Method Detail

      • unit

        public java.lang.String unit()
      • count

        public long count()
      • min

        public double min()
      • max

        public double max()
      • average

        public double average()
      • standardDeviation

        public double standardDeviation()
      • sample

        public void sample​(double value)
      • getValue

        public java.lang.String getValue()
        Computes the Standard Statistic Results based on the samples collected so far and provides the complete value as a formatted String
      • toString

        public java.lang.String toString()
        Users can extend StatisticsAccumulator to provide the complete Stats in the format they prefer, if the default format doesn't suffice.
        Overrides:
        toString in class java.lang.Object
      • clearState

        public void clearState()
        Clears the samples and starts fresh on new samples.
      • unitTestValidate

        public void unitTestValidate​(java.lang.String expectedUnit,
                                     double expectedMin,
                                     double expectedMax,
                                     long expectedSampleCount,
                                     double expectedAverage,
                                     double expectedStandardDeviation)
        This is an internal API to test StatisticsAccumulator...