MobilityDB 1.1

◆ span_bound_cmp()

int span_bound_cmp ( const SpanBound b1,
const SpanBound b2 
)

Compare two span boundary points, returning <0, 0, or >0 according to whether the first one is less than, equal to, or greater than the second one.

The boundaries can be any combination of upper and lower; so it's useful for a variety of operators.

The simple case is when b1 and b2 are both inclusive, in which case the result is just a comparison of the values held in b1 and b2.

If a bound is exclusive, then we need to know whether it's a lower bound, in which case we treat the boundary point as "just greater than" the held value; or an upper bound, in which case we treat the boundary point as "just less than" the held value.

There is only one case where two boundaries compare equal but are not identical: when both bounds are inclusive and hold the same value, but one is an upper bound and the other a lower bound.