Package org.apache.storm.windowing

# Class TupleWindowImpl

java.lang.Object
org.apache.storm.windowing.TupleWindowImpl

All Implemented Interfaces:
  `TupleWindow`, `Window<Tuple>`

public class TupleWindowImpl extends Object implements TupleWindow
Holds the expired, new and current tuples in a window.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TupleWindowImpl(List<Tuple> tuples, List<Tuple> newTuples, List<Tuple> expiredTuples)`
  `TupleWindowImpl(List<Tuple> tuples, List<Tuple> newTuples, List<Tuple> expiredTuples, Long startTimestamp, Long endTimestamp)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `List<Tuple>`
  `get()`
  Gets the list of events in the window.
  `Long`
  `getEndTimestamp()`
  If processing based on event time, returns the window end time based on watermark otherwise returns the window end time based on processing time.
  `List<Tuple>`
  `getExpired()`
  Get the list of events expired from the window since the last time the window was generated.
  `List<Tuple>`
  `getNew()`
  Get the list of newly added events in the window since the last time the window was generated.
  `Long`
  `getStartTimestamp()`
  Returns the window start timestamp.
  `int`
  `hashCode()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.storm.windowing.Window

  `getIter`

- ## Constructor Details

  - ### TupleWindowImpl

    public TupleWindowImpl(List<Tuple> tuples, List<Tuple> newTuples, List<Tuple> expiredTuples)

  - ### TupleWindowImpl

    public TupleWindowImpl(List<Tuple> tuples, List<Tuple> newTuples, List<Tuple> expiredTuples, Long startTimestamp, Long endTimestamp)

- ## Method Details

  - ### get

    public List<Tuple> get()
    Description copied from interface: `Window`
    Gets the list of events in the window.

    Note: If the number of tuples in windows is huge, invoking `get` would load all the tuples into memory and may throw an OOM exception. Use windowing with persistence (`BaseStatefulWindowedBolt.withPersistence()`) and `Window.getIter()` to retrieve an iterator over the events in the window.

    Specified by:
      `get` in interface `Window<Tuple>`
    Returns:
      the list of events in the window.

  - ### getNew

    public List<Tuple> getNew()
    Description copied from interface: `Window`
    Get the list of newly added events in the window since the last time the window was generated.

    Note: This is not supported when using windowing with persistence (`BaseStatefulWindowedBolt.withPersistence()`).

    Specified by:
      `getNew` in interface `Window<Tuple>`
    Returns:
      the list of newly added events in the window.

  - ### getExpired

    public List<Tuple> getExpired()
    Description copied from interface: `Window`
    Get the list of events expired from the window since the last time the window was generated.

    Note: This is not supported when using windowing with persistence (`BaseStatefulWindowedBolt.withPersistence()`).

    Specified by:
      `getExpired` in interface `Window<Tuple>`
    Returns:
      the list of events expired from the window.

  - ### getStartTimestamp

    public Long getStartTimestamp()
    Description copied from interface: `Window`
    Returns the window start timestamp. Will return null if the window length is not based on time duration.
    Specified by:
      `getStartTimestamp` in interface `Window<Tuple>`
    Returns:
      the window start timestamp or null if the window length is not time based

  - ### getEndTimestamp

    public Long getEndTimestamp()
    Description copied from interface: `Window`
    If processing based on event time, returns the window end time based on watermark otherwise returns the window end time based on processing time.
    Specified by:
      `getEndTimestamp` in interface `Window<Tuple>`
    Returns:
      the window end timestamp

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`