public class OverlapDetector<T> extends 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 | Description |
---|---|
OverlapDetector(int lhsBuffer,
int rhsBuffer) |
Constructs an overlap detector.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addAll(List<T> objects,
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(List<T> intervals) |
Creates a new OverlapDetector with no trim and the given set of intervals.
|
Set<T> |
getAll() |
Gets all the objects that could be returned by the overlap detector.
|
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(List<T> intervals)
public void addLhs(T object, Locatable interval)
public void addAll(List<T> objects, List<? extends Locatable> intervals)
public boolean overlapsAny(Locatable locatable)
! getOverlaps(locatable).isEmpty()