APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.math

public Class FloatCounter

extends Object
implements Poolable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.Pool.Poolable
Imports
com.badlogic.gdx.utils.Pool.Poolable

Track properties of a stream of float values. The properties (total value, minimum, etc) are updated as values are put(float) into the stream.
Author
xoppa

Field Summary

Modifier and TypeField and Description
public float
average

The average value (total / count)

public int
count

The amount of values added

public float
latest

The latest raw value

public float
max

The largest value

public final WindowedMean
mean

Provides access to the WindowedMean if any (can be null)

public float
min

The smallest value

public float
total

The sum of all values

public float
value

The current windowed mean value

Constructor Summary

AccessConstructor and Description
public
FloatCounter(int
The size of the mean window or 1 or below to not use a windowed mean.
windowSize
)

Construct a new FloatCounter

Method Summary

Modifier and TypeMethod and Description
public void
put(float
The value to add
value
)

Add a value and update all fields.

public void
reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Reset all values to their default value.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

averageback to summary
public float average

The average value (total / count)

countback to summary
public int count

The amount of values added

latestback to summary
public float latest

The latest raw value

maxback to summary
public float max

The largest value

meanback to summary
public final WindowedMean mean

Provides access to the WindowedMean if any (can be null)

minback to summary
public float min

The smallest value

totalback to summary
public float total

The sum of all values

valueback to summary
public float value

The current windowed mean value

Constructor Detail

FloatCounterback to summary
public FloatCounter(int windowSize)

Construct a new FloatCounter

Parameters
windowSize:int

The size of the mean window or 1 or below to not use a windowed mean.

Method Detail

putback to summary
public void put(float value)

Add a value and update all fields.

Parameters
value:float

The value to add

resetback to summary
public void reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Reset all values to their default value.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override