Lines Matching refs:comparator

32  * {@link Range}, this allows the use of an arbitrary comparator. This is designed for use in the
57 * Returns the whole range relative to the specified comparator.
59 static <T> GeneralRange<T> all(Comparator<? super T> comparator) {
60 return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN);
64 * Returns everything above the endpoint relative to the specified comparator, with the specified
67 static <T> GeneralRange<T> downTo(Comparator<? super T> comparator, @Nullable T endpoint,
69 return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN);
73 * Returns everything below the endpoint relative to the specified comparator, with the specified
76 static <T> GeneralRange<T> upTo(Comparator<? super T> comparator, @Nullable T endpoint,
78 return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType);
82 * Returns everything between the endpoints relative to the specified comparator, with the
85 static <T> GeneralRange<T> range(Comparator<? super T> comparator, @Nullable T lower,
87 return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType);
90 private final Comparator<? super T> comparator;
100 private GeneralRange(Comparator<? super T> comparator, boolean hasLowerBound,
103 this.comparator = checkNotNull(comparator);
112 comparator.compare(lowerEndpoint, lowerEndpoint);
115 comparator.compare(upperEndpoint, upperEndpoint);
118 int cmp = comparator.compare(lowerEndpoint, upperEndpoint);
128 Comparator<? super T> comparator() {
129 return comparator;
150 int cmp = comparator.compare(t, lbound);
159 int cmp = comparator.compare(t, ubound);
172 checkArgument(comparator.equals(other.comparator));
183 int cmp = comparator.compare(lowerEndpoint, other.lowerEndpoint);
199 int cmp = comparator.compare(upperEndpoint, other.upperEndpoint);
207 int cmp = comparator.compare(lowEnd, upEnd);
216 return new GeneralRange<T>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType);
223 return comparator.equals(r.comparator) && hasLowerBound == r.hasLowerBound
234 return Objects.hashCode(comparator, lowerEndpoint, lowerBoundType, upperEndpoint,
241 * Returns the same range relative to the reversed comparator.
247 new GeneralRange<T>(Ordering.from(comparator).reverse(), hasUpperBound, upperEndpoint,
258 builder.append(comparator).append(":");