Class WindowingCollection<T>
java.lang.Object
com.scaleoutsoftware.collections.timewindowing.WindowingCollection<T>
- Type Parameters:
T- the object type of the source collection.
- All Implemented Interfaces:
Iterable<TimeWindow<T>>
- Direct Known Subclasses:
SessionWindowCollection,SlidingWindowCollection,TumblingWindowCollection
Used to transform a List into an iterable collection of
TimeWindow.
Items whose timestamp precede the collections start time are evicted from the collection.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe source collection of items for a windowing collection.longThe inclusive start time of first window of a windowing collection.The timestamp selector is used to select a timestamp from an element in the source collection. -
Constructor Summary
ConstructorsConstructorDescriptionWindowingCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs) Instantiate a new WindowingCollection. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
_sourceCollection
The source collection of items for a windowing collection. -
_timestampSelector
The timestamp selector is used to select a timestamp from an element in the source collection. -
_startTimeMs
public long _startTimeMsThe inclusive start time of first window of a windowing collection.
-
-
Constructor Details
-
WindowingCollection
public WindowingCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs) Instantiate a new WindowingCollection.- 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.
-
-
Method Details
-
add
Adds an item to the underlying source collection in chronological order.- Parameters:
item- the item to add.
-