|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.util.RollingWindowAverage
public class RollingWindowAverage
Calculates an average of values showing up in a given time window. To keep processing efficient, bucketing is performed.
This class is not thread-safe.
| Field Summary | |
|---|---|
static int |
MILLIS
Helpful constant for one millisecond. |
static int |
MINUTE
Helpful constant for one minute. |
static int |
SECOND
Helpful constant for one second. |
| Constructor Summary | |
|---|---|
RollingWindowAverage(long windowSizeMillis,
long bucketSizeMillis)
|
|
| Method Summary | |
|---|---|
void |
add(long timestamp,
long value)
Adds a new entry. |
double |
getCurrentAverage()
|
long |
getUpdatesInWindow()
Returns the number of updates kept in the rolling window's scope. |
long |
getWindowSizeMillis()
Returns the size of the rolling window. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MILLIS
public static final int SECOND
public static final int MINUTE
| Constructor Detail |
|---|
public RollingWindowAverage(long windowSizeMillis,
long bucketSizeMillis)
| Method Detail |
|---|
public final void add(long timestamp,
long value)
public final double getCurrentAverage()
public final long getUpdatesInWindow()
public final long getWindowSizeMillis()
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||