Skip to content

Commit

Permalink
Add Selection::{overlaps,without} and fix contains
Browse files Browse the repository at this point in the history
Adds two helper functions to `Selection`:

* `overlaps`: tests whether two `Selection`s contain any ranges which
  overlap with each other
* `without`: Computes a new `Selection` that is the set difference
  of two `Selection`s, i.e. everything in the first `Selection`
  with everything that overlaps in the second `Selection` removed,
  potentially leaving holes in the original ranges.

It also fixes a bug with `Selection::contains`: it assumes that if the
second `Selection` has a greater number of ranges than the first, then
the first cannot contain the second; but this is false, since one range
from the first could contain multiple smaller ranges in the second.
  • Loading branch information
dead10ck committed Mar 6, 2023
1 parent ae7e718 commit 0b5d95f
Showing 1 changed file with 452 additions and 9 deletions.
Loading

0 comments on commit 0b5d95f

Please sign in to comment.