Class Value


  • public class Value
    extends Handle
    A statistical variable, typically representing a sampling of an arbitrarily changing parameter.
    Author:
    Steinar Knutsen
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Value.Parameters
      Parameters for building Value instances.
    • Constructor Summary

      Constructors 
      Constructor Description
      Value​(java.lang.String name, Statistics manager, Value.Parameters parameters)
      Configure a Value instance fully, no raw config access.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Value buildValue​(java.lang.String name, Statistics manager, Value.Parameters defaults)
      Build a Value which should be initialized from config.
      boolean equals​(java.lang.Object o)  
      double get()
      Get last value logged, 0 if nothing logged since reset.
      double getMax()
      Get maximum value logged since last reset.
      double getMean()
      Get mean value since last reset.
      double getMin()
      Get minimal value logged since last reset.
      int hashCode()  
      void put​(double x)
      Insert x, do all pertinent operations.
      void reset()
      Set last value logged container to 0, reset histogram and set all counters and derived statistics to 0.
      void runHandle()
      Dump state to log and reset.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Value

        public Value​(java.lang.String name,
                     Statistics manager,
                     Value.Parameters parameters)
        Configure a Value instance fully, no raw config access.
        Parameters:
        name - tag for logging
        manager - the statistics manager acquired by injection
        parameters - all the parameters necessary for initializing a Value
        Throws:
        java.lang.IllegalStateException - if Parameters.limits exists and is not frozen
    • Method Detail

      • buildValue

        public static Value buildValue​(java.lang.String name,
                                       Statistics manager,
                                       Value.Parameters defaults)
        Build a Value which should be initialized from config.
        Parameters:
        name - the name of the event in the log
        manager - the current Statistics manager, acquired by injection
        defaults - defaults for values not defined by config, this may be null
      • put

        public void put​(double x)
        Insert x, do all pertinent operations. (Update histogram, update insertion count for calculating mean, etc.)
      • getMean

        public double getMean()
        Get mean value since last reset.
      • getMin

        public double getMin()
        Get minimal value logged since last reset.
      • getMax

        public double getMax()
        Get maximum value logged since last reset.
      • get

        public double get()
        Get last value logged, 0 if nothing logged since reset.
      • reset

        public void reset()
        Set last value logged container to 0, reset histogram and set all counters and derived statistics to 0.
      • runHandle

        public void runHandle()
        Dump state to log and reset.
        Specified by:
        runHandle in class Handle
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in class Handle
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class Handle