public class OverlapDetector<T>
extends java.lang.Object
OverlapDetector<Locatable> detector = OverlapDetector.create(locatables);
Set<Locatable> overlaps = detector.getOverlaps(query);
boolean anyOverlap = detector.overlapsAny(query); //faster API for checking presence of any overlap
Constructor and Description |
---|
OverlapDetector(int lhsBuffer,
int rhsBuffer)
Constructs an overlap detector.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(java.util.List<T> objects,
java.util.List<? extends Locatable> intervals)
Adds all items to the overlap detector.
|
void |
addLhs(T object,
Locatable interval)
Adds a Locatable to the set of Locatables against which to match candidates.
|
static <T extends Locatable> |
create(java.util.List<T> intervals)
Creates a new OverlapDetector with no trim and the given set of intervals.
|
java.util.Set<T> |
getAll()
Gets all the objects that could be returned by the overlap detector.
|
java.util.Set<T> |
getOverlaps(Locatable locatable)
Gets the Set of objects that overlap the provided locatable.
|
boolean |
overlapsAny(Locatable locatable)
Returns true iff the given locatable overlaps any locatable in this detector.
|
public OverlapDetector(int lhsBuffer, int rhsBuffer)
lhsBuffer
- the amount by which to "trim" coordinates of mappings on the left
hand side when calculating overlapsrhsBuffer
- the amount by which to "trim" coordinates of mappings on the right
hand side when calculating overlapspublic static <T extends Locatable> OverlapDetector<T> create(java.util.List<T> intervals)
public void addLhs(T object, Locatable interval)
public void addAll(java.util.List<T> objects, java.util.List<? extends Locatable> intervals)
public java.util.Set<T> getAll()
public boolean overlapsAny(Locatable locatable)
! getOverlaps(locatable).isEmpty()