Class RangeSetUtils
java.lang.Object
org.aksw.commons.collection.rangeset.RangeSetUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
Set<com.google.common.collect.Range<T>>complement(Supplier<Iterator<com.google.common.collect.Range<T>>> iteratorSupp, Function<com.google.common.collect.Range<T>, Endpoint<T>> getNearerEndpoint, Function<com.google.common.collect.Range<T>, Endpoint<T>> getFartherEndpoint, BiFunction<Endpoint<T>, Endpoint<T>, com.google.common.collect.Range<T>> createRange, com.google.common.collect.Range<T> restriction) static <T extends Comparable<T>>
Set<com.google.common.collect.Range<T>>complementAsDescendingSetOfRanges(com.google.common.collect.RangeSet<T> set, com.google.common.collect.Range<T> restriction) static <T extends Comparable<T>>
Set<com.google.common.collect.Range<T>>complementAsRanges(com.google.common.collect.RangeSet<T> set, com.google.common.collect.Range<T> restriction) Create an iterable over the complement of a range set w.r.t.static <T extends Comparable<T>>
Set<com.google.common.collect.Range<T>>difference(com.google.common.collect.RangeSet<T> aset, com.google.common.collect.RangeSet<T> bset) Return a set view of the differences; for every range of a remove all segments that overlap with bstatic <T extends Comparable<T>>
Collection<com.google.common.collect.Range<T>>getRangesBeforeAndAfter(com.google.common.collect.RangeSet<T> rangeSet, T value) Returs a collection (list) of the range before and after the value (if they exist).static <T extends Comparable<T>>
Collection<com.google.common.collect.Range<T>>intersection(com.google.common.collect.RangeSet<T> a, com.google.common.collect.RangeSet<T> b) static <T extends Comparable<T>>
Set<com.google.common.collect.Range<T>>symmetricDifference(com.google.common.collect.RangeSet<T> aset, com.google.common.collect.RangeSet<T> bset)
-
Constructor Details
-
RangeSetUtils
public RangeSetUtils()
-
-
Method Details
-
intersection
public static <T extends Comparable<T>> Collection<com.google.common.collect.Range<T>> intersection(com.google.common.collect.RangeSet<T> a, com.google.common.collect.RangeSet<T> b) -
getRangesBeforeAndAfter
public static <T extends Comparable<T>> Collection<com.google.common.collect.Range<T>> getRangesBeforeAndAfter(com.google.common.collect.RangeSet<T> rangeSet, T value) Returs a collection (list) of the range before and after the value (if they exist). Should both ranges exist and connect on the value then the span is created resulting in the range surrounding the value.- Parameters:
value-- Returns:
-
difference
public static <T extends Comparable<T>> Set<com.google.common.collect.Range<T>> difference(com.google.common.collect.RangeSet<T> aset, com.google.common.collect.RangeSet<T> bset) Return a set view of the differences; for every range of a remove all segments that overlap with b -
symmetricDifference
public static <T extends Comparable<T>> Set<com.google.common.collect.Range<T>> symmetricDifference(com.google.common.collect.RangeSet<T> aset, com.google.common.collect.RangeSet<T> bset) -
complementAsRanges
public static <T extends Comparable<T>> Set<com.google.common.collect.Range<T>> complementAsRanges(com.google.common.collect.RangeSet<T> set, com.google.common.collect.Range<T> restriction) Create an iterable over the complement of a range set w.r.t. a restriction range. Although the result is a set, all operations require iteration.- Type Parameters:
T-- Parameters:
set-restriction-- Returns:
-
complementAsDescendingSetOfRanges
public static <T extends Comparable<T>> Set<com.google.common.collect.Range<T>> complementAsDescendingSetOfRanges(com.google.common.collect.RangeSet<T> set, com.google.common.collect.Range<T> restriction) -
complement
public static <T extends Comparable<T>> Set<com.google.common.collect.Range<T>> complement(Supplier<Iterator<com.google.common.collect.Range<T>>> iteratorSupp, Function<com.google.common.collect.Range<T>, Endpoint<T>> getNearerEndpoint, Function<com.google.common.collect.Range<T>, Endpoint<T>> getFartherEndpoint, BiFunction<Endpoint<T>, Endpoint<T>, com.google.common.collect.Range<T>> createRange, com.google.common.collect.Range<T> restriction)
-