java.lang.Object
net.i2p.stat.RateAverages
Storage space for computations of various averages.
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptiondoubleThe weighted average.doubleThe current average.doublegetLast()The last average.static RateAveragesgetTemp()Thread-local temp instance.longThe total event count.doubleThe total values.static voidrelease()Remove the thread-local temp instance.(package private) voidreset()Reset all fields to zero.(package private) voidsetAverage(double average) Stores the weighted average.(package private) voidsetCurrent(double current) Stores the current period average.(package private) voidsetLast(double last) Stores the last period average.(package private) voidsetTotalEventCount(long totalEventCount) Stores the total event count.(package private) voidsetTotalValues(double totalValues) Stores the total values sum.
Constructor Details
RateAverages
public RateAverages()Create a new RateAverages.
Method Details
getTemp
release
public static void release()Remove the thread-local temp instance.reset
void reset()Reset all fields to zero.getAverage
public double getAverage()The weighted average.- Returns:
- one of several things: if there are any events (current or last) => weighted average otherwise if the useLifetime parameter to Rate.computeAverages was: true => the lifetime average value false => zero
setAverage
void setAverage(double average) Stores the weighted average.- Parameters:
average- the combined period average, or the lifetime average if no events were recorded
getCurrent
public double getCurrent()The current average.- Returns:
- the current average == current value / current event count
setCurrent
void setCurrent(double current) Stores the current period average.- Parameters:
current- the current period's value total divided by its event count
getLast
public double getLast()The last average.- Returns:
- the last average == last value / last event count
setLast
void setLast(double last) Stores the last period average.- Parameters:
last- the previous period's value total divided by its event count
getTotalEventCount
public long getTotalEventCount()The total event count.- Returns:
- the total event count == current + last event counts
setTotalEventCount
void setTotalEventCount(long totalEventCount) Stores the total event count.- Parameters:
totalEventCount- the current and previous periods' event counts added together
getTotalValues
public double getTotalValues()The total values.- Returns:
- the total values == current + last values
setTotalValues
void setTotalValues(double totalValues) Stores the total values sum.- Parameters:
totalValues- the current and previous periods' value totals added together