@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryInterval that = (QueryInterval) o; return this.compareTo(that) == 0; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryInterval that = (QueryInterval) o; return this.compareTo(that) == 0; }
/** * a small utility to inform if one interval is cleanly before another, meaning that they do not overlap and * the first is prior (in genomic order) to the second * * @param lhs the "first" {@link QueryInterval} * @param rhs the "second" {@link QueryInterval} * @return true if the to intervals do not intersect _and_ the first is prior to the second in genomic order */ private static boolean isCleanlyBefore(final QueryInterval lhs, final QueryInterval rhs) { return !lhs.overlaps(rhs) && lhs.compareTo(rhs) < 0; }
/** * a small utility to inform if one interval is cleanly before another, meaning that they do not overlap and * the first is prior (in genomic order) to the second * * @param lhs the "first" {@link QueryInterval} * @param rhs the "second" {@link QueryInterval} * @return true if the to intervals do not intersect _and_ the first is prior to the second in genomic order */ private static boolean isCleanlyBefore(final QueryInterval lhs, final QueryInterval rhs) { return !lhs.overlaps(rhs) && lhs.compareTo(rhs) < 0; }
/** * @throws java.lang.IllegalArgumentException if the intervals are not optimized * @see QueryInterval#optimizeIntervals(QueryInterval[]) */ private void assertIntervalsOptimized(final QueryInterval[] intervals) { if (intervals.length == 0) return; for (int i = 1; i < intervals.length; ++i) { final QueryInterval prev = intervals[i-1]; final QueryInterval thisInterval = intervals[i]; if (prev.compareTo(thisInterval) >= 0) { throw new IllegalArgumentException(String.format("List of intervals is not sorted: %s >= %s", prev, thisInterval)); } if (prev.overlaps(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s intersects %s", prev, thisInterval)); } if (prev.endsAtStartOf(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s abuts %s", prev, thisInterval)); } } }
/** * @throws java.lang.IllegalArgumentException if the intervals are not optimized * @see QueryInterval#optimizeIntervals(QueryInterval[]) */ private void assertIntervalsOptimized(final QueryInterval[] intervals) { if (intervals.length == 0) return; for (int i = 1; i < intervals.length; ++i) { final QueryInterval prev = intervals[i-1]; final QueryInterval thisInterval = intervals[i]; if (prev.compareTo(thisInterval) >= 0) { throw new IllegalArgumentException(String.format("List of intervals is not sorted: %s >= %s", prev, thisInterval)); } if (prev.overlaps(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s intersects %s", prev, thisInterval)); } if (prev.endsAtStartOf(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s abuts %s", prev, thisInterval)); } } }
/** * @throws java.lang.IllegalArgumentException if the intervals are not optimized * @see QueryInterval#optimizeIntervals(QueryInterval[]) */ private void assertIntervalsOptimized(final QueryInterval[] intervals) { if (intervals.length == 0) return; for (int i = 1; i < intervals.length; ++i) { final QueryInterval prev = intervals[i-1]; final QueryInterval thisInterval = intervals[i]; if (prev.compareTo(thisInterval) >= 0) { throw new IllegalArgumentException(String.format("List of intervals is not sorted: %s >= %s", prev, thisInterval)); } if (prev.overlaps(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s intersects %s", prev, thisInterval)); } if (prev.endsAtStartOf(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s abuts %s", prev, thisInterval)); } } }
/** * @throws java.lang.IllegalArgumentException if the intervals are not optimized * @see QueryInterval#optimizeIntervals(QueryInterval[]) */ private void assertIntervalsOptimized(final QueryInterval[] intervals) { if (intervals.length == 0) return; for (int i = 1; i < intervals.length; ++i) { final QueryInterval prev = intervals[i-1]; final QueryInterval thisInterval = intervals[i]; if (prev.compareTo(thisInterval) >= 0) { throw new IllegalArgumentException(String.format("List of intervals is not sorted: %s >= %s", prev, thisInterval)); } if (prev.overlaps(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s intersects %s", prev, thisInterval)); } if (prev.abuts(thisInterval)) { throw new IllegalArgumentException(String.format("List of intervals is not optimized: %s abuts %s", prev, thisInterval)); } } }