Skip to content

Instantly share code, notes, and snippets.

@davideanastasia
Last active September 3, 2019 05:54
Show Gist options
  • Save davideanastasia/1e63c8a3f5c51636a80d39e869032a0d to your computer and use it in GitHub Desktop.
Save davideanastasia/1e63c8a3f5c51636a80d39e869032a0d to your computer and use it in GitHub Desktop.
spatial_beam_01.java
public class TiledIntervalWindow extends BoundedWindow {
private final String hexAddr;
private final Instant start;
private final Instant end;
public TiledIntervalWindow(String hexAddr, Instant start, Instant end) {
this.hexAddr = hexAddr;
this.start = start;
this.end = end;
}
// ...
private boolean isDisjoint(TiledIntervalWindow other) {
return !this.end.isAfter(other.start) || !other.end.isAfter(this.start);
}
public boolean intersects(TiledIntervalWindow other) {
return this.hexAddr.equals(other.hexAddr) && !this.isDisjoint(other);
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment