com.planetj.taste.impl.common
Class CompactRunningAverage
java.lang.Object
com.planetj.taste.impl.common.CompactRunningAverage
- All Implemented Interfaces:
- RunningAverage, java.io.Serializable
- Direct Known Subclasses:
- CompactRunningAverageAndStdDev
public class CompactRunningAverage
- extends java.lang.Object
- implements RunningAverage, java.io.Serializable
Like FullRunningAverage but uses smaller values (short, float)
to conserve memory. This is used in SlopeOneRecommender
since it may allocate tens of millions of such objects.
- Since:
- 1.3.1
- Author:
- Sean Owen
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CompactRunningAverage
public CompactRunningAverage()
addDatum
public void addDatum(double datum)
- Specified by:
addDatum in interface RunningAverage
- Parameters:
datum - new item to add to the running average
removeDatum
public void removeDatum(double datum)
- Specified by:
removeDatum in interface RunningAverage
- Parameters:
datum - item to remove to the running average
changeDatum
public void changeDatum(double delta)
- Specified by:
changeDatum in interface RunningAverage
- Parameters:
delta - amount by which to change a datum in the running average
getCount
public int getCount()
- Specified by:
getCount in interface RunningAverage
getAverage
public double getAverage()
- Specified by:
getAverage in interface RunningAverage
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object