Package com.biglybt.core.util.average
Class AverageFactory
java.lang.Object
com.biglybt.core.util.average.AverageFactory
Generates different types of averages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExponentialMovingAverage
ExponentialMovingAverage
(float weight) Create an exponential moving average, with the given smoothing weight.static ExponentialMovingAverage
ExponentialMovingAverage
(int periods) Create an exponential moving average, smoothing over the given number of periods, using a default smoothing weight value of 2/(1 + periods).static <T> long
LazyMovingImmediateAverage
(int periods, int interval_secs, AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance) static <T> long
LazySmoothMovingImmediateAverage
(AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance) Creates an auto-updating immediate moving average that will auto-deactivate average maintenance when values are not being extracted from it, auto-reactivate when required etc.static MovingAverage
MovingAverage
(int periods) Create a moving average, that moves over the given number of periods.static MovingImmediateAverage
MovingImmediateAverage
(int periods) Create a moving average, that moves over the given number of periods and gives immediate results (i.e.static RunningAverage
Create a simple running average.
-
Constructor Details
-
AverageFactory
public AverageFactory()
-
-
Method Details
-
RunningAverage
Create a simple running average. -
MovingAverage
Create a moving average, that moves over the given number of periods. -
MovingImmediateAverage
Create a moving average, that moves over the given number of periods and gives immediate results (i.e. after the first update of X the average will be X -
ExponentialMovingAverage
Create an exponential moving average, smoothing over the given number of periods, using a default smoothing weight value of 2/(1 + periods). -
ExponentialMovingAverage
Create an exponential moving average, with the given smoothing weight. Larger weigths (closer to 1.0) will give more influence to recent data and smaller weights (closer to 0.00) will provide smoother averaging (give more influence to older data). -
LazySmoothMovingImmediateAverage
public static <T> long LazySmoothMovingImmediateAverage(AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance) Creates an auto-updating immediate moving average that will auto-deactivate average maintenance when values are not being extracted from it, auto-reactivate when required etc.- Parameters:
adapter
-instance
-periods
-- Returns:
-
LazyMovingImmediateAverage
public static <T> long LazyMovingImmediateAverage(int periods, int interval_secs, AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance)
-