@Test public void shouldIntersectWhenOtherOverlapsStartAndOnFinish() { R range = getTestRange(from("10"), to("20")); R other = getTestRange(from("5"), to("20")); R expected = getTestRange(from("10"), to("20")); assertEquals(expected, range.intersection(other)); assertEquals(expected, other.intersection(range)); }
@Override public R intersection(R other) { C max = max(this.start, other.start()); C min = min(this.end, other.end()); return newInstance(max, min); }
AbstractRange implements Range<C, R> { @Override public R intersection(R other) { C max = max(this.start, other.start()); C min = min(this.end, other.end()); return newInstance(max, min); } }
AbstractRange implements Range<C, R> { @Override public R intersection(R other) { C max = max(this.start, other.start()); C min = min(this.end, other.end()); return newInstance(max, min); } protected  AbstractRange(C start, C end); }
AbstractRange implements Range<C, R> { @Override public R intersection(R other) { C max = max(this.start, other.start()); C min = min(this.end, other.end()); return newInstance(max, min); } protected  AbstractRange(C start, C end); @Override C start(); @Override C end(); @Override boolean contains(R other); @Override boolean contains(C value); @Override boolean overlaps(R other); @Override boolean isConsecutive(R other); @Override boolean isEmpty(); @Override R merge(R other); @Override R intersection(R other); @SuppressWarnings({"unchecked"}) @Override List<R> exclude(R other); @Override boolean isSameRange(R other); @Override String toString(); @Override Iterator<C> iterator(); @Override final boolean equals(Object o); @Override final int hashCode(); }
AbstractRange implements Range<C, R> { @Override public R intersection(R other) { C max = max(this.start, other.start()); C min = min(this.end, other.end()); return newInstance(max, min); } protected  AbstractRange(C start, C end); @Override C start(); @Override C end(); @Override boolean contains(R other); @Override boolean contains(C value); @Override boolean overlaps(R other); @Override boolean isConsecutive(R other); @Override boolean isEmpty(); @Override R merge(R other); @Override R intersection(R other); @SuppressWarnings({"unchecked"}) @Override List<R> exclude(R other); @Override boolean isSameRange(R other); @Override String toString(); @Override Iterator<C> iterator(); @Override final boolean equals(Object o); @Override final int hashCode();  }