java.lang.Object
com.scaleoutsoftware.collections.timewindowing.Windowing

public class Windowing extends Object
Static functions that transform a List into an iterable collection of 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 collection
      timestampSelector - the selector used to pull timestamps from objects
      startTimeMs - the start time to use when scanning the collection
      endTimeMs - the end time to use when scanning the collection
      timeoutDurationMs - 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 collection
      timestampSelector - the selector used to pull timestamps from objects
      startTimeMs - the start time to use when scanning the collection
      endTimeMs - the end time to use when scanning the collection
      windowDurationMs - 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 collection
      timestampSelector - the selector used to pull timestamp from objects
      startTimeMs - the start time to use when scanning the collection
      endTimeMs - the end time to use when scanning the collection
      windowDurationMs - the length of time in each time window
      everyDurationMs - the time between the starting point of each time window
      Returns:
      an iterable collection of sliding windows