Package org.apache.calcite.util
Class RangeSets
java.lang.Object
org.apache.calcite.util.RangeSets
Utilities for Guava 
RangeSet.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceConsumer ofRangevalues.static interfaceDeconstructor forRangevalues.
- 
Method SummaryModifier and TypeMethodDescriptionstatic <C extends Comparable<C>>
 intcompare(com.google.common.collect.Range<C> r0, com.google.common.collect.Range<C> r1) Compares two ranges.static <C extends Comparable<C>>
 intcompare(com.google.common.collect.RangeSet<C> s0, com.google.common.collect.RangeSet<C> s1) Compares two range sets.static <C extends Comparable<C>,C2 extends Comparable<C2>> 
 com.google.common.collect.Range<C2>Copies a range.static <C extends Comparable<C>,C2 extends Comparable<C2>> 
 com.google.common.collect.RangeSet<C2>Copies a range set.static <C extends Comparable<C>>
 intcountPoints(com.google.common.collect.RangeSet<C> rangeSet) Returns the number of ranges in a range set that are points.static <C extends Comparable<C>>
 voidforEach(com.google.common.collect.Range<C> range, RangeSets.Consumer<C> consumer) static <C extends Comparable<C>>
 voidforEach(com.google.common.collect.RangeSet<C> rangeSet, RangeSets.Consumer<C> consumer) static <C extends Comparable<C>>
 inthashCode(com.google.common.collect.RangeSet<C> rangeSet) Computes a hash code for a range set.static <C extends Comparable<C>>
 booleanisOpenInterval(com.google.common.collect.RangeSet<C> rangeSet) Returns whether a range set is a single open interval.static <C extends Comparable<C>>
 booleanisPoint(com.google.common.collect.Range<C> range) Returns whether a range is a point.static <C extends Comparable<C>,R> 
 Rmap(com.google.common.collect.Range<C> range, RangeSets.Handler<C, R> handler) Calls the appropriate handler method for the type of range.static <C extends Comparable<C>,C2 extends Comparable<C2>> 
 com.google.common.collect.RangeSet<C2>map(com.google.common.collect.RangeSet<C> rangeSet, RangeSets.Handler<C, com.google.common.collect.Range<C2>> handler) Calls the appropriate handler method for each range in a range set, creating a new range set from the results.static <C extends Comparable<C>>
 com.google.common.collect.RangeSet<C>minus(com.google.common.collect.RangeSet<C> rangeSet, com.google.common.collect.Range<C> range) Subtracts a range from a range set.static <C extends Comparable<C>>
 RangeSets.Consumer<C>printer(StringBuilder sb, BiConsumer<StringBuilder, C> valuePrinter) Creates a consumer that prints values to aStringBuilder.static <C extends Comparable<C>>
 com.google.common.collect.RangeSet<C>Returns the unrestricted range set.
- 
Method Details- 
minuspublic static <C extends Comparable<C>> com.google.common.collect.RangeSet<C> minus(com.google.common.collect.RangeSet<C> rangeSet, com.google.common.collect.Range<C> range) Subtracts a range from a range set.
- 
rangeSetAllReturns the unrestricted range set.
- 
comparepublic static <C extends Comparable<C>> int compare(com.google.common.collect.RangeSet<C> s0, com.google.common.collect.RangeSet<C> s1) Compares two range sets.
- 
comparepublic static <C extends Comparable<C>> int compare(com.google.common.collect.Range<C> r0, com.google.common.collect.Range<C> r1) Compares two ranges.
- 
hashCodepublic static <C extends Comparable<C>> int hashCode(com.google.common.collect.RangeSet<C> rangeSet) Computes a hash code for a range set.This method does not compute the same result as RangeSet.hashCode(). That is a poor hash code because it is based uponSet.hashCode()).The algorithm is based on List.hashCode(), which is well-defined becauseRangeSet.asRanges()is sorted.
- 
isPointReturns whether a range is a point.
- 
isOpenIntervalpublic static <C extends Comparable<C>> boolean isOpenInterval(com.google.common.collect.RangeSet<C> rangeSet) Returns whether a range set is a single open interval.
- 
countPointspublic static <C extends Comparable<C>> int countPoints(com.google.common.collect.RangeSet<C> rangeSet) Returns the number of ranges in a range set that are points.If every range in a range set is a point then it can be converted to a SQL IN list. 
- 
mappublic static <C extends Comparable<C>,C2 extends Comparable<C2>> com.google.common.collect.RangeSet<C2> map(com.google.common.collect.RangeSet<C> rangeSet, RangeSets.Handler<C, com.google.common.collect.Range<C2>> handler) Calls the appropriate handler method for each range in a range set, creating a new range set from the results.
- 
mappublic static <C extends Comparable<C>,R> R map(com.google.common.collect.Range<C> range, RangeSets.Handler<C, R> handler) Calls the appropriate handler method for the type of range.
- 
copypublic static <C extends Comparable<C>,C2 extends Comparable<C2>> com.google.common.collect.RangeSet<C2> copy(com.google.common.collect.RangeSet<C> rangeSet, Function<C, C2> map) Copies a range set.
- 
copypublic static <C extends Comparable<C>,C2 extends Comparable<C2>> com.google.common.collect.Range<C2> copy(com.google.common.collect.Range<C> range, Function<C, C2> map) Copies a range.
- 
forEachpublic static <C extends Comparable<C>> void forEach(com.google.common.collect.RangeSet<C> rangeSet, RangeSets.Consumer<C> consumer) 
- 
forEachpublic static <C extends Comparable<C>> void forEach(com.google.common.collect.Range<C> range, RangeSets.Consumer<C> consumer) 
- 
printerpublic static <C extends Comparable<C>> RangeSets.Consumer<C> printer(StringBuilder sb, BiConsumer<StringBuilder, C> valuePrinter) Creates a consumer that prints values to aStringBuilder.
 
-