public boolean includes(Marker marker) { requireNonNull(marker, "marker is null"); checkTypeCompatibility(marker); return low.compareTo(marker) <= 0 && high.compareTo(marker) >= 0; }
public Range intersect(Range other) { checkTypeCompatibility(other); if (!this.overlaps(other)) { throw new IllegalArgumentException("Cannot intersect non-overlapping ranges"); } Marker lowMarker = Marker.max(low, other.getLow()); Marker highMarker = Marker.min(high, other.getHigh()); return new Range(lowMarker, highMarker); }
public Range span(Range other) { checkTypeCompatibility(other); Marker lowMarker = Marker.min(low, other.getLow()); Marker highMarker = Marker.max(high, other.getHigh()); return new Range(lowMarker, highMarker); }
public boolean contains(Range other) { checkTypeCompatibility(other); return this.getLow().compareTo(other.getLow()) <= 0 && this.getHigh().compareTo(other.getHigh()) >= 0; }
public boolean overlaps(Range other) { checkTypeCompatibility(other); return this.getLow().compareTo(other.getHigh()) <= 0 && other.getLow().compareTo(this.getHigh()) <= 0; }
public boolean includes(Marker marker) { requireNonNull(marker, "marker is null"); checkTypeCompatibility(marker); return low.compareTo(marker) <= 0 && high.compareTo(marker) >= 0; }
public Range intersect(Range other) { checkTypeCompatibility(other); if (!this.overlaps(other)) { throw new IllegalArgumentException("Cannot intersect non-overlapping ranges"); } Marker lowMarker = Marker.max(low, other.getLow()); Marker highMarker = Marker.min(high, other.getHigh()); return new Range(lowMarker, highMarker); }
public Range span(Range other) { checkTypeCompatibility(other); Marker lowMarker = Marker.min(low, other.getLow()); Marker highMarker = Marker.max(high, other.getHigh()); return new Range(lowMarker, highMarker); }
public boolean contains(Range other) { checkTypeCompatibility(other); return this.getLow().compareTo(other.getLow()) <= 0 && this.getHigh().compareTo(other.getHigh()) >= 0; }
public boolean overlaps(Range other) { checkTypeCompatibility(other); return this.getLow().compareTo(other.getHigh()) <= 0 && other.getLow().compareTo(this.getHigh()) <= 0; }