Constructor and Description |
---|
SlidingTimeWindowReservoir(long window,
java.util.concurrent.TimeUnit windowUnit)
Creates a new
SlidingTimeWindowReservoir with the given window of time. |
SlidingTimeWindowReservoir(long window,
java.util.concurrent.TimeUnit windowUnit,
Clock clock)
Creates a new
SlidingTimeWindowReservoir with the given clock and window of time. |
Modifier and Type | Method and Description |
---|---|
Snapshot |
getSnapshot()
Returns a snapshot of the reservoir's values.
|
int |
size()
Returns the number of values recorded.
|
void |
update(long value)
Adds a new recorded value to the reservoir.
|
public SlidingTimeWindowReservoir(long window, java.util.concurrent.TimeUnit windowUnit)
SlidingTimeWindowReservoir
with the given window of time.window
- the window of timewindowUnit
- the unit of window
public SlidingTimeWindowReservoir(long window, java.util.concurrent.TimeUnit windowUnit, Clock clock)
SlidingTimeWindowReservoir
with the given clock and window of time.window
- the window of timewindowUnit
- the unit of window
clock
- the Clock
to usepublic int size()
Reservoir
public void update(long value)
Reservoir
public Snapshot getSnapshot()
Reservoir
getSnapshot
in interface Reservoir
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"