/** Returns the whole range relative to the specified comparator. */ static <T> GeneralRange<T> all(Comparator<? super T> comparator) { return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN); }
/** Returns the whole range relative to the specified comparator. */ static <T> GeneralRange<T> all(Comparator<? super T> comparator) { return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN); }
/** Returns the whole range relative to the specified comparator. */ static <T> GeneralRange<T> all(Comparator<? super T> comparator) { return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN); }
/** * Returns everything below the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> upTo( Comparator<? super T> comparator, @Nullable T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType); }
/** * Returns everything above the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> downTo( Comparator<? super T> comparator, @Nullable T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN); }
/** * Returns everything below the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> upTo( Comparator<? super T> comparator, @NullableDecl T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType); }
/** * Returns everything above the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> downTo( Comparator<? super T> comparator, @NullableDecl T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN); }
/** * Returns everything between the endpoints relative to the specified comparator, with the * specified endpoint behavior. */ static <T> GeneralRange<T> range( Comparator<? super T> comparator, @Nullable T lower, BoundType lowerType, @Nullable T upper, BoundType upperType) { return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType); }
/** * Returns everything above the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> downTo( Comparator<? super T> comparator, @NullableDecl T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN); }
/** * Returns everything below the endpoint relative to the specified comparator, with the specified * endpoint behavior. */ static <T> GeneralRange<T> upTo( Comparator<? super T> comparator, @NullableDecl T endpoint, BoundType boundType) { return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType); }
/** * Returns everything between the endpoints relative to the specified comparator, with the * specified endpoint behavior. */ static <T> GeneralRange<T> range( Comparator<? super T> comparator, @NullableDecl T lower, BoundType lowerType, @NullableDecl T upper, BoundType upperType) { return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType); }
/** * Returns everything between the endpoints relative to the specified comparator, with the * specified endpoint behavior. */ static <T> GeneralRange<T> range( Comparator<? super T> comparator, @NullableDecl T lower, BoundType lowerType, @NullableDecl T upper, BoundType upperType) { return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType); }
/** Returns the same range relative to the reversed comparator. */ GeneralRange<T> reverse() { GeneralRange<T> result = reverse; if (result == null) { result = new GeneralRange<T>( Ordering.from(comparator).reverse(), hasUpperBound, getUpperEndpoint(), getUpperBoundType(), hasLowerBound, getLowerEndpoint(), getLowerBoundType()); result.reverse = this; return this.reverse = result; } return result; }
/** Returns the same range relative to the reversed comparator. */ GeneralRange<T> reverse() { GeneralRange<T> result = reverse; if (result == null) { result = new GeneralRange<T>( Ordering.from(comparator).reverse(), hasUpperBound, getUpperEndpoint(), getUpperBoundType(), hasLowerBound, getLowerEndpoint(), getLowerBoundType()); result.reverse = this; return this.reverse = result; } return result; }
/** Returns the same range relative to the reversed comparator. */ GeneralRange<T> reverse() { GeneralRange<T> result = reverse; if (result == null) { result = new GeneralRange<T>( Ordering.from(comparator).reverse(), hasUpperBound, getUpperEndpoint(), getUpperBoundType(), hasLowerBound, getLowerEndpoint(), getLowerBoundType()); result.reverse = this; return this.reverse = result; } return result; }
/** Converts a Range to a GeneralRange. */ static <T extends Comparable> GeneralRange<T> from(Range<T> range) { @Nullable T lowerEndpoint = range.hasLowerBound() ? range.lowerEndpoint() : null; BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : OPEN; @Nullable T upperEndpoint = range.hasUpperBound() ? range.upperEndpoint() : null; BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : OPEN; return new GeneralRange<T>( Ordering.natural(), range.hasLowerBound(), lowerEndpoint, lowerBoundType, range.hasUpperBound(), upperEndpoint, upperBoundType); }
return new GeneralRange<T>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType);
/** Converts a Range to a GeneralRange. */ static <T extends Comparable> GeneralRange<T> from(Range<T> range) { @NullableDecl T lowerEndpoint = range.hasLowerBound() ? range.lowerEndpoint() : null; BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : OPEN; @NullableDecl T upperEndpoint = range.hasUpperBound() ? range.upperEndpoint() : null; BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : OPEN; return new GeneralRange<T>( Ordering.natural(), range.hasLowerBound(), lowerEndpoint, lowerBoundType, range.hasUpperBound(), upperEndpoint, upperBoundType); }
/** Converts a Range to a GeneralRange. */ static <T extends Comparable> GeneralRange<T> from(Range<T> range) { @NullableDecl T lowerEndpoint = range.hasLowerBound() ? range.lowerEndpoint() : null; BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : OPEN; @NullableDecl T upperEndpoint = range.hasUpperBound() ? range.upperEndpoint() : null; BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : OPEN; return new GeneralRange<T>( Ordering.natural(), range.hasLowerBound(), lowerEndpoint, lowerBoundType, range.hasUpperBound(), upperEndpoint, upperBoundType); }
return new GeneralRange<T>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType);