/** * Determines whether this interval contains the entire region represented by other * (in other words, whether it covers it). * * * @param other interval to check * @return true if this interval contains all of the base positions spanned by other, otherwise false */ default boolean contains(Locatable other) { return contigsMatch(other) && CoordMath.encloses(getStart(), getEnd(), other.getStart(), other.getEnd()); }
/** * Determines whether this interval contains the entire region represented by other * (in other words, whether it covers it). * * * @param other interval to check * @return true if this interval contains all of the base positions spanned by other, otherwise false */ default boolean contains(Locatable other) { return contigsMatch(other) && CoordMath.encloses(getStart(), getEnd(), other.getStart(), other.getEnd()); }
/** * Determines whether this interval comes within {@code distance} of overlapping the provided locatable. * When distance = 0 this is equal to {@link #overlaps(Locatable)} * * @param other interval to check * @param distance how many bases may be between the two intervals for us to still consider them overlapping. * @return true if this interval overlaps other, otherwise false */ default boolean withinDistanceOf(Locatable other, int distance) { return contigsMatch(other) && CoordMath.overlaps(getStart(), getEnd(), other.getStart()-distance, other.getEnd()+distance); }
/** * Determines whether this interval comes within {@code distance} of overlapping the provided locatable. * When distance = 0 this is equal to {@link #overlaps(Locatable)} * * @param other interval to check * @param distance how many bases may be between the two intervals for us to still consider them overlapping. * @return true if this interval overlaps other, otherwise false */ default boolean withinDistanceOf(Locatable other, int distance) { return contigsMatch(other) && CoordMath.overlaps(getStart(), getEnd(), other.getStart()-distance, other.getEnd()+distance); }