public abstract class Window
extends java.lang.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.
|
java.time.Instant |
endTime()
Return the end time of this window.
|
boolean |
equals(java.lang.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.
|
java.time.Instant |
startTime()
Return the start time of this window.
|
java.lang.String |
toString() |
public Window(long startMs, long endMs) throws java.lang.IllegalArgumentException
startMs
- the start timestamp of the windowendMs
- the end timestamp of the windowjava.lang.IllegalArgumentException
- if startMs
is negative or if endMs
is smaller than startMs
public long start()
public long end()
public java.time.Instant startTime()
public java.time.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
otherwisepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object