public abstract class Window extends Object
Window
is agnostic if start/end boundaries are inclusive or exclusive; this is defined by concrete
window implementations.
To specify how Window
boundaries are defined use Windows
.
For time semantics, see TimestampExtractor
.
Windows
,
TimeWindow
,
SessionWindow
,
UnlimitedWindow
,
TimestampExtractor
Modifier and Type | Field and Description |
---|---|
protected long |
endMs |
protected long |
startMs |
Constructor and Description |
---|
Window(long startMs,
long endMs)
Create a new window for the given start and end time.
|
Modifier and Type | Method and Description |
---|---|
long |
end()
Return the end timestamp of this window.
|
Instant |
endTime()
Return the end time of this window.
|
boolean |
equals(Object obj) |
int |
hashCode() |
abstract boolean |
overlap(Window other)
Check if the given window overlaps with this window.
|
long |
start()
Return the start timestamp of this window.
|
Instant |
startTime()
Return the start time of this window.
|
String |
toString() |
public Window(long startMs, long endMs) throws IllegalArgumentException
startMs
- the start timestamp of the windowendMs
- the end timestamp of the windowIllegalArgumentException
- if startMs
is negative or if endMs
is smaller than startMs
public long start()
public long end()
public Instant startTime()
public Instant endTime()
public abstract boolean overlap(Window other)
IllegalArgumentException
if the other
window has a different type than this
window.other
- another window of the same typetrue
if other
overlaps with this window—false
otherwise