summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Zerrer <him@jakezerrer.com>2025-11-26 15:10:20 -0500
committerJake Zerrer <him@jakezerrer.com>2025-12-02 13:30:50 -0500
commitb908cb5b0a605165ab9e216b56f49b0cabd77224 (patch)
tree60cd198d0e5bb879e622c4311b067b80d45555f6
parent3c626a88ec37c0ab4a87e6730556ac4d4e1eb90e (diff)
Coerce ratios to longs in some cases
-rw-r--r--src/unheard/interval.clj12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/unheard/interval.clj b/src/unheard/interval.clj
index 2ec5645..c10161c 100644
--- a/src/unheard/interval.clj
+++ b/src/unheard/interval.clj
@@ -5,8 +5,16 @@
(deftype RatioValueInterval [start end value]
IInterval
- (getNormStart [_] start)
- (getNormEnd [_] end)
+ ;; HACK: coerce start to long to work around
+ ;; class clojure.lang.BigInt cannot be cast to class java.lang.Comparable
+ (getNormStart [_] (if (instance? clojure.lang.BigInt start)
+ (long start)
+ start))
+ ;; HACK: coerce start to long to work around
+ ;; class clojure.lang.BigInt cannot be cast to class java.lang.Comparable
+ (getNormEnd [_] (if (instance? clojure.lang.BigInt end)
+ (long end)
+ end))
(getUniqueIdentifier [_] (str "[" start "," end "]"))
(compareTo [_ other]
(let [start-cmp (compare start (.getNormStart ^RatioValueInterval other))]