Skip to content

Commit

Permalink
Merge branch 'release/v0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEnglish committed May 29, 2023
2 parents ef818cd + a04bd8c commit 0627cfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "regioners"
version = "0.3.0"
version = "0.3.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
12 changes: 6 additions & 6 deletions src/overlappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ pub enum Overlapper {
impl Overlapper {
pub fn ovl(&self, a_intv: &Lapper<u64, u64>, b_intv: &Lapper<u64, u64>) -> u64 {
match self {
/* Return number of A intervals intersecting a B intervals */
/* Return number of B intervals intersecting each A interval */
Overlapper::All => a_intv
.iter()
.map(|i| b_intv.find(i.start, i.stop).count() as u64)
.sum(),
/* Return number of A intervals intersecting a B intervals */
Overlapper::Any => a_intv
.iter()
.map(|i| match b_intv.find(i.start, i.stop).next() {
Some(_) => 1,
None => 0,
})
.sum(),
/* Return number of b intervals intersecting each of a's intervals */
Overlapper::Any => a_intv
.iter()
.map(|i| b_intv.find(i.start, i.stop).count() as u64)
.sum(),
}
}
}

0 comments on commit 0627cfa

Please sign in to comment.