From 5fd1f68a58ef3bbf37528b9397a6950d7af661ab Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 15 Dec 2022 16:26:54 -0800 Subject: [PATCH] Tiebreak ordering of ranges with the same lower bound using upper bound. --- src/pyutils/collectionz/interval_tree.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyutils/collectionz/interval_tree.py b/src/pyutils/collectionz/interval_tree.py index 7ba190a..a8278a2 100644 --- a/src/pyutils/collectionz/interval_tree.py +++ b/src/pyutils/collectionz/interval_tree.py @@ -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: -- 2.45.2