mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

feature request: intersect method for RangeSet #1825

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
[Via email, kevinb encouraged me to submit this request.]

RangeSet is great, and provides me with lots of useful capabilities. There is 
one fundamental, useful operation that's unexpectedly missing: intersect. 
There's a subRangeSet method, but it only operates on a single Range, not 
another RangeSet.

Since there is a union method (aka addAll), and a complement method, I should 
be able to cobble together an intersect method thus:
  <T> RangeSet<T> intersect(RangeSet<T> a, RangeSet<T> b) {
    RangeSet inverse = TreeRangeSet.create(a.complement);
    inverse.addAll(b.complement());
    return inverse.complement();
  }

Nonetheless, life would be simpler and more worry-free for all users if the API 
directly supported an intersect method.

Original issue reported on code.google.com by dpletc...@google.com on 1 Aug 2014 at 9:32

GoogleCodeExporter commented 9 years ago
See also issue 1778, which addresses this use case but unfortunately has 
received no review or triage in two months.

Original comment by heue...@gmail.com on 5 Aug 2014 at 3:35

GoogleCodeExporter commented 9 years ago
I feel like if we were to do this, it should be a magic view method, which I 
think would be feasible, just somewhat tricky?

Original comment by lowas...@google.com on 6 Aug 2014 at 5:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The code referred to in issue 1778 has been open sourced under the LPGL version 
3 or later license.

https://github.com/nmdp-bioinformatics/ngs/tree/master/range/src/main/java/org/n
mdp/ngs/range/tree

Original comment by heue...@gmail.com on 24 Sep 2014 at 9:38

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07