Browse Source

Merge branch 'master' into cartoon-repr

Alexander Rose 6 years ago
parent
commit
87eafde58b

+ 3 - 0
src/mol-data/int/_spec/ordered-set.spec.ts

@@ -56,6 +56,9 @@ describe('ordered set', () => {
 
         expect(OrderedSet.areIntersecting(Interval.ofRange(4, 5), arr12369)).toBe(false);
         expect(OrderedSet.areIntersecting(Interval.ofRange(7, 8), arr12369)).toBe(false);
+
+        expect(OrderedSet.areIntersecting(Interval.ofRange(6, 6), arr12369)).toBe(true);
+        expect(OrderedSet.areIntersecting(Interval.ofRange(3, 4), OrderedSet.ofSortedArray([0, 1, 10]))).toBe(false);
     });
 
     it('isSubset', () => {

+ 1 - 4
src/mol-data/int/impl/ordered-set.ts

@@ -99,10 +99,7 @@ export function subtract(a: OrderedSetImpl, b: OrderedSetImpl) {
 function areEqualIS(a: I, b: S) { return I.size(a) === S.size(b) && I.start(a) === S.start(b) && I.end(a) === S.end(b); }
 
 function areIntersectingSI(a: S, b: I) {
-    if (S.size(a) === 0 || I.size(b) === 0) return false
-    const predAMinB = S.findPredecessorIndex(a, I.min(b))
-    const predAMaxB = S.findPredecessorIndex(a, I.max(b))
-    return predAMinB !== predAMaxB
+    return a.length !== 0 && I.size(S.findRange(a, I.min(b), I.max(b))) !== 0;
 }
 
 function isSubsetSI(a: S, b: I) {