net.sourceforge.jabm.util
Class FixedLengthQueue

java.lang.Object
  extended by net.sourceforge.jabm.util.FixedLengthQueue
All Implemented Interfaces:
Resetable

public class FixedLengthQueue
extends java.lang.Object
implements Resetable

A queue with fixed length, which can be useful when tracking a sliding window on a data series

 

Field Summary
protected  int count
           
protected  int curIndex
           
protected  double[] list
           
protected  double sum
           
 
Constructor Summary
FixedLengthQueue(int length)
           
 
Method Summary
 int count()
           
 double getMean()
           
 void initialize()
           
 void newData(double value)
           
 void reset()
          Reinitialise our state to the original settings.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

protected double[] list

curIndex

protected int curIndex

sum

protected double sum

count

protected int count
Constructor Detail

FixedLengthQueue

public FixedLengthQueue(int length)
Method Detail

initialize

public void initialize()

reset

public void reset()
Description copied from interface: Resetable
Reinitialise our state to the original settings.

Specified by:
reset in interface Resetable

newData

public void newData(double value)

count

public int count()

getMean

public double getMean()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object