org.datanucleus.util
Class MathUtils.SMA

java.lang.Object
  extended by org.datanucleus.util.MathUtils.SMA
Enclosing class:
MathUtils

public static class MathUtils.SMA
extends java.lang.Object

Simple Moving Average


Constructor Summary
MathUtils.SMA(int length)
           
 
Method Summary
 double compute(double value)
          Compute the moving average.
 double currentAverage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtils.SMA

public MathUtils.SMA(int length)
Parameters:
length - the maximum length
Method Detail

currentAverage

public double currentAverage()

compute

public double compute(double value)
Compute the moving average. Synchronised so that no changes in the underlying data is made during calculation.

Parameters:
value - The value
Returns:
The average


Copyright © 2009. All Rights Reserved.