Package arc.math

Class FloatCounter

java.lang.Object
arc.math.FloatCounter

public class FloatCounter extends Object
Track properties of a stream of float values. The properties (total value, minimum, etc) are updated as values are put(float) into the stream.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
    The average value (total / count)
    int
    The amount of values added
    float
    The latest raw value
    float
    The largest value
    Provides access to the WindowedMean if any (can be null)
    float
    The smallest value
    float
    The sum of all values
    float
    The current windowed mean value
  • Constructor Summary

    Constructors
    Constructor
    Description
    FloatCounter(int windowSize)
    Construct a new FloatCounter
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    put(float value)
    Add a value and update all fields.
    void
    Reset all values to their default value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mean

      public final WindowedMean mean
      Provides access to the WindowedMean if any (can be null)
    • count

      public int count
      The amount of values added
    • total

      public float total
      The sum of all values
    • min

      public float min
      The smallest value
    • max

      public float max
      The largest value
    • average

      public float average
      The average value (total / count)
    • latest

      public float latest
      The latest raw value
    • value

      public float value
      The current windowed mean value
  • Constructor Details

    • FloatCounter

      public FloatCounter(int windowSize)
      Construct a new FloatCounter
      Parameters:
      windowSize - The size of the mean window or 1 or below to not use a windowed mean.
  • Method Details

    • put

      public void put(float value)
      Add a value and update all fields.
      Parameters:
      value - The value to add
    • reset

      public void reset()
      Reset all values to their default value.