Class SlidingWindowCollection<T>
java.lang.Object
com.scaleoutsoftware.collections.timewindowing.WindowingCollection<T>
com.scaleoutsoftware.collections.timewindowing.SlidingWindowCollection<T>
- Type Parameters:
T- the object type of the source collection.
- All Implemented Interfaces:
Iterable<TimeWindow<T>>
The SlidingWindowCollection transforms a collection into an iterable collection of overlapping time windows. This
wrapper class can be used to manage the retention policy and add objects in chronological order to the underlying
source collection.
The difference between
SlidingWindowCollection and WatermarkedSlidingWindowCollection is that
windows in the WatermarkedSlidingWindowCollection can be closed if the watermark passes the inclusive end of
a window.-
Field Summary
Fields inherited from class com.scaleoutsoftware.collections.timewindowing.WindowingCollection
_sourceCollection, _startTimeMs, _timestampSelector -
Constructor Summary
ConstructorsConstructorDescriptionSlidingWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long windowDurationMs, long everyMs) Instantiates a new SlidingWindowCollection -
Method Summary
Modifier and TypeMethodDescriptionvoidforEach(Consumer<? super TimeWindow<T>> action) iterator()Methods inherited from class com.scaleoutsoftware.collections.timewindowing.WindowingCollection
add
-
Constructor Details
-
SlidingWindowCollection
public SlidingWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long windowDurationMs, long everyMs) Instantiates a new SlidingWindowCollection- Parameters:
sourceCollection- the underlying source collectiontimestampSelector- theTimestampSelectoris used to pull a timestamp from an item in the source collection and subsequent insertions.startTimeMs- the first time an object can be in a time window -- items before the start time will be evicted. The start time is also the start time of the first time window.windowDurationMs- the duration of a time windoweveryMs- the time between the starting point of each time window
-
-
Method Details
-
iterator
-
forEach
-
spliterator
-