Class Windowing
java.lang.Object
com.scaleoutsoftware.collections.timewindowing.Windowing
Static functions that transform a List into an iterable collection of TimeWindows.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterable<TimeWindow<T>> toSessionWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long timeoutDurationMs) Transforms a List into an iterable collection of session TimeWindows.static <T> Iterable<TimeWindow<T>> toSlidingWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long windowDurationMs, long everyDurationMs) Transforms a List into an iterable collection of sliding TimeWindowsstatic <T> Iterable<TimeWindow<T>> toTumblingWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long windowDurationMs) Transforms a List into an iterable collection of tumbling TimeWindows.
-
Method Details
-
toSessionWindows
public static <T> Iterable<TimeWindow<T>> toSessionWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long timeoutDurationMs) Transforms a List into an iterable collection of session TimeWindows.- Type Parameters:
T- the type of objects in the source collection- Parameters:
sourceCollection- the source collectiontimestampSelector- the selector used to pull timestamps from objectsstartTimeMs- the start time to use when scanning the collectionendTimeMs- the end time to use when scanning the collectiontimeoutDurationMs- the minimum amount of time between session window ranges- Returns:
- an iterable collection of session windows
-
toTumblingWindows
public static <T> Iterable<TimeWindow<T>> toTumblingWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long windowDurationMs) Transforms a List into an iterable collection of tumbling TimeWindows.- Type Parameters:
T- the type of objects in the source collection- Parameters:
sourceCollection- the source collectiontimestampSelector- the selector used to pull timestamps from objectsstartTimeMs- the start time to use when scanning the collectionendTimeMs- the end time to use when scanning the collectionwindowDurationMs- the length of time in each time window- Returns:
- an iterable collection of tumbling windows
-
toSlidingWindows
public static <T> Iterable<TimeWindow<T>> toSlidingWindows(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long endTimeMs, long windowDurationMs, long everyDurationMs) Transforms a List into an iterable collection of sliding TimeWindows- Type Parameters:
T- the type of objects in the source collection- Parameters:
sourceCollection- the source collectiontimestampSelector- the selector used to pull timestamp from objectsstartTimeMs- the start time to use when scanning the collectionendTimeMs- the end time to use when scanning the collectionwindowDurationMs- the length of time in each time windoweveryDurationMs- the time between the starting point of each time window- Returns:
- an iterable collection of sliding windows
-