@Test public void testIntersection() { final LongRange intersection1 = LongRangeUtils.getIntersection(ORIGINAL, OUTSIDE); assertNull(intersection1); final LongRange intersection2 = LongRangeUtils.getIntersection(ORIGINAL, SAME_EDGE_INSIDE); assertEquals(SAME_EDGE_INSIDE, intersection2); final LongRange intersection3 = LongRangeUtils.getIntersection(ORIGINAL, SAME_EDGE_OUTSIDE); assertEquals(new LongRange(2, 2), intersection3); final LongRange intersection4 = LongRangeUtils.getIntersection(ORIGINAL, INSIDE); assertEquals(new LongRange(4, 5), intersection4); }
public static LongRange getIntersection(final LongRange range1, final LongRange range2) { if (!range1.overlapsRange(range2)) { return null; } else { final long min1 = range1.getMinimumLong(); final long max1 = range1.getMaximumLong(); final long min2 = range2.getMinimumLong(); final long max2 = range2.getMaximumLong(); return new LongRange(Math.max(min1, min2), Math.min(max1, max2)); } }
LongRangeUtils { public static LongRange getIntersection(final LongRange range1, final LongRange range2) { if (!range1.overlapsRange(range2)) { return null; } else { final long min1 = range1.getMinimumLong(); final long max1 = range1.getMaximumLong(); final long min2 = range2.getMinimumLong(); final long max2 = range2.getMaximumLong(); return new LongRange(Math.max(min1, min2), Math.min(max1, max2)); } } }
LongRangeUtils { public static LongRange getIntersection(final LongRange range1, final LongRange range2) { if (!range1.overlapsRange(range2)) { return null; } else { final long min1 = range1.getMinimumLong(); final long max1 = range1.getMaximumLong(); final long min2 = range2.getMinimumLong(); final long max2 = range2.getMaximumLong(); return new LongRange(Math.max(min1, min2), Math.min(max1, max2)); } } private  LongRangeUtils(); }
LongRangeUtils { public static LongRange getIntersection(final LongRange range1, final LongRange range2) { if (!range1.overlapsRange(range2)) { return null; } else { final long min1 = range1.getMinimumLong(); final long max1 = range1.getMaximumLong(); final long min2 = range2.getMinimumLong(); final long max2 = range2.getMaximumLong(); return new LongRange(Math.max(min1, min2), Math.min(max1, max2)); } } private  LongRangeUtils(); static NavigableSet<LongRange> createLongRangeSet(); static Set<LongRange> generateDenseLongRanges(final SortedSet<Long> longSortedSet); static LongRange getIntersection(final LongRange range1, final LongRange range2); static Set<LongRange> getComplement(final LongRange range1, final LongRange range2); static List<Pair<Long, Long>> fromRangesToPairs(final List<LongRange> rangeList); static List<LongRange> fromPairsToRanges(final List<Pair<Long, Long>> pairList); }
LongRangeUtils { public static LongRange getIntersection(final LongRange range1, final LongRange range2) { if (!range1.overlapsRange(range2)) { return null; } else { final long min1 = range1.getMinimumLong(); final long max1 = range1.getMaximumLong(); final long min2 = range2.getMinimumLong(); final long max2 = range2.getMaximumLong(); return new LongRange(Math.max(min1, min2), Math.min(max1, max2)); } } private  LongRangeUtils(); static NavigableSet<LongRange> createLongRangeSet(); static Set<LongRange> generateDenseLongRanges(final SortedSet<Long> longSortedSet); static LongRange getIntersection(final LongRange range1, final LongRange range2); static Set<LongRange> getComplement(final LongRange range1, final LongRange range2); static List<Pair<Long, Long>> fromRangesToPairs(final List<LongRange> rangeList); static List<LongRange> fromPairsToRanges(final List<Pair<Long, Long>> pairList); static final Comparator<LongRange> LONG_RANGE_COMPARATOR; }