|
|
@@ -286,23 +286,18 @@ cdef class IntervalSet: |
|
|
|
(potentially) subsetted to make the one that is being |
|
|
|
returned. |
|
|
|
""" |
|
|
|
if not isinstance(interval, Interval): |
|
|
|
raise TypeError("bad type") |
|
|
|
for n in self.tree.intersect(interval.start, interval.end): |
|
|
|
i = n.obj |
|
|
|
if i: |
|
|
|
if i.start >= interval.start and i.end <= interval.end: |
|
|
|
if orig: |
|
|
|
yield (i, i) |
|
|
|
else: |
|
|
|
yield i |
|
|
|
else: |
|
|
|
subset = i.subset(max(i.start, interval.start), |
|
|
|
min(i.end, interval.end)) |
|
|
|
if orig: |
|
|
|
yield (subset, i) |
|
|
|
else: |
|
|
|
yield subset |
|
|
|
if orig: |
|
|
|
for n in self.tree.intersect(interval.start, interval.end): |
|
|
|
i = n.obj |
|
|
|
subset = i.subset(max(i.start, interval.start), |
|
|
|
min(i.end, interval.end)) |
|
|
|
yield (subset, i) |
|
|
|
else: |
|
|
|
for n in self.tree.intersect(interval.start, interval.end): |
|
|
|
i = n.obj |
|
|
|
subset = i.subset(max(i.start, interval.start), |
|
|
|
min(i.end, interval.end)) |
|
|
|
yield subset |
|
|
|
|
|
|
|
cpdef intersects(self, Interval other): |
|
|
|
"""Return True if this IntervalSet intersects another interval""" |
|
|
|