Class AverageFactory

java.lang.Object
com.biglybt.core.util.average.AverageFactory

public abstract class AverageFactory extends Object
Generates different types of averages.
  • Constructor Details

    • AverageFactory

      public AverageFactory()
  • Method Details

    • RunningAverage

      public static RunningAverage RunningAverage()
      Create a simple running average.
    • MovingAverage

      public static MovingAverage MovingAverage(int periods)
      Create a moving average, that moves over the given number of periods.
    • MovingImmediateAverage

      public static MovingImmediateAverage MovingImmediateAverage(int periods)
      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

      public 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).
    • ExponentialMovingAverage

      public static ExponentialMovingAverage ExponentialMovingAverage(float weight)
      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:
      periods -
      adapter -
      instance -
      Returns:
    • LazyMovingImmediateAverage

      public static <T> long LazyMovingImmediateAverage(int periods, int interval_secs, AverageFactory.LazyMovingImmediateAverageAdapter<T> adapter, T instance)