/** * Implementation of {@link #union(Range)} to be invoked directly by subclasses. "NC" stands for * "No Cast" - this method do not try to cast the value to a compatible type. */ final Range<?> unionNC(final Range<? extends T> range) throws IllegalArgumentException { final Range<? extends T> union, min, max; min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) > 0 ? range : this; max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) < 0 ? range : this; if (min == max) { union = min; } else { union = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded); } assert union.contains(min) : min; assert union.contains(max) : max; return union; }
/** * If the specified value is inside a range, returns the index of this range. Otherwise, returns * {@code -1}. * * @param value The value to search. * @return The index of the range which contains this value, or -1 if there is no such range. */ public int indexOfRange(final Comparable value) { int index = binarySearch(toArrayElement(value)); if (index < 0) { // Found an insertion point. Make sure that the insertion // point is inside a range (i.e. before the maximum value). index = ~index; // Tild sign, not minus. if ((index & 1) == 0) { return -1; } } index /= 2; // Round toward 0 (odd index are maximum values). assert newRange(get(2 * index), get(2 * index + 1)).contains(value) : value; return index; }
private boolean rangeFilterAccepts(Range rangeFilter, Object domainValue) { if (rangeFilter == null) { return true; } if (domainValue instanceof Range) { return rangeFilter.intersects((Range) domainValue); } else { return rangeFilter.contains((Comparable) domainValue); } }
/** * Implementation of {@link #union(Range)} to be invoked directly by subclasses. * "NC" stands for "No Cast" - this method do not try to cast the value to a compatible type. */ final Range<?> unionNC(final Range<? extends T> range) throws IllegalArgumentException { final Range<? extends T> union, min, max; min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) > 0 ? range : this; max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) < 0 ? range : this; if (min == max) { union = min; } else { union = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded); } assert union.contains(min) : min; assert union.contains(max) : max; return union; }
.contains(Long.valueOf(commit.getCommitter().getTimestamp())); if (!applies) { return false;
/** * If the specified value is inside a range, returns the index of this range. * Otherwise, returns {@code -1}. * * @param value The value to search. * @return The index of the range which contains this value, or -1 if there is no such range. */ public int indexOfRange(final Comparable value) { int index = binarySearch(toArrayElement(value)); if (index < 0) { // Found an insertion point. Make sure that the insertion // point is inside a range (i.e. before the maximum value). index = ~index; // Tild sign, not minus. if ((index & 1) == 0) { return -1; } } index /= 2; // Round toward 0 (odd index are maximum values). assert newRange(get(2*index), get(2*index+1)).contains(value) : value; return index; }
.contains(Long.valueOf(commit.getCommitter().getTimestamp())); if (!applies) { return false;
.contains(Long.valueOf(commit.getCommitter().getTimestamp())); if (!applies) { return false;