Package com.badlogic.gdx.math
Class FloatCounter
- java.lang.Object
-
- com.badlogic.gdx.math.FloatCounter
-
- All Implemented Interfaces:
Pool.Poolable
public class FloatCounter extends java.lang.Object implements Pool.Poolable
Track properties of a stream of float values. The properties (total value, minimum, etc) are updated as values areput(float)
into the stream.
-
-
Field Summary
Fields Modifier and Type Field Description float
average
The average value (total / count)int
count
The amount of values addedfloat
latest
The latest raw valuefloat
max
The largest valueWindowedMean
mean
Provides access to the WindowedMean if any (can be null)float
min
The smallest valuefloat
total
The sum of all valuesfloat
value
The current windowed mean value
-
Constructor Summary
Constructors Constructor Description FloatCounter(int windowSize)
Construct a new FloatCounter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
put(float value)
Add a value and update all fields.void
reset()
Reset all values to their default value.java.lang.String
toString()
-
-
-
Field Detail
-
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
-
mean
public final WindowedMean mean
Provides access to the WindowedMean if any (can be null)
-
-
Method Detail
-
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.- Specified by:
reset
in interfacePool.Poolable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-