Tiebreak ordering of ranges with the same lower bound using upper bound.
authorScott Gasch <[email protected]>
Fri, 16 Dec 2022 00:26:54 +0000 (16:26 -0800)
committerScott Gasch <[email protected]>
Fri, 16 Dec 2022 00:26:54 +0000 (16:26 -0800)
src/pyutils/collectionz/interval_tree.py

index 7ba190a5984814eb35ff7058181cdc3a79342dd6..a8278a2dc8ea835a501951e3abddb9727d405930 100644 (file)
@@ -47,7 +47,10 @@ class NumericRange(object):
         Returns:
             True is this range is less than (lower low) other, else False.
         """
-        return self.low < other.low
+        if self.low != other.low:
+            return self.low < other.low
+        else:
+            return self.high < other.high
 
     @overrides
     def __eq__(self, other: object) -> bool: