Class AverageFactory
java.lang.Object
com.biglybt.core.util.average.AverageFactory
Generates different types of averages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExponentialMovingAverageExponentialMovingAverage(float weight) Create an exponential moving average, with the given smoothing weight.static ExponentialMovingAverageExponentialMovingAverage(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> longLazyMovingImmediateAverage(int periods, int interval_secs, AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance) static <T> longLazySmoothMovingImmediateAverage(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 MovingAverageMovingAverage(int periods) Create a moving average, that moves over the given number of periods.static MovingImmediateAverageMovingImmediateAverage(int periods) Create a moving average, that moves over the given number of periods and gives immediate results (i.e.static RunningAverageCreate 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)
-