compareEndToStart

Compares the end of this interval to the start of another interval.

Returns -1 if this ends before the other starts. Returns 1 if this ends after (see below) the other starts. Returns 0 if this exactly meets (see below) the other with no overlap

To clarify, compareEndToStart([a, b), [b, c)) == 0, but compareEndToStart([a, b], [b, c]) == 1. This might be unintuitive, but I've found this to be much more useful in practice than -1 and 0, respectively. This is because as long as this interval starts before the argument, we get a few properties:

  • -1 indicates a gap between them

  • 1 indicates overlap between them

  • 0 indicates no gap and no overlap

Assumes neither interval is empty.