Is it possible to determine wether two rigth-unbounded intervals (intervals with one boundary at infinity) overlap or not?
I've tried this (and other similar variations):
Instant now = new Instant(new Date().getTime());
Interval i2 = new Interval(now, (ReadableInstant) null);
Interval i1 = new Interval(now, (ReadableInstant) null);
boolean overlapping = i2.overlaps(i1);
But according to the docs, using null
as a second parameter means "now" instead of "infinity".
EDIT: I've found this answer in the mailing list, so it seems to be impossible with Joda. I am now looking for alternative implementations.
If both intervals start at t = -∞
, or if both intervals end at t = +∞
, they will always overlap, regardless of the start date.
If interval A
starts at t = -∞
and interval B
ends at t = +∞
, they overlap iffA.start > B.start
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With