接口 LongPairRangeSet<T extends Comparable<T>>
public interface LongPairRangeSet<T extends Comparable<T>>
A set comprising zero or more ranges type of key-value pair.
-
嵌套类概要
嵌套类修饰符和类型接口说明static classLongPairRangeSet.DefaultRangeSet<T extends Comparable<T>>Generic implementation of a default range set.static classThis class is a simple key-value data structure.static interfaceRepresents a function that accepts two long arguments and produces a result.static interfaceRepresents a function that accepts result and produces a LongPair.static interfaceLongPairRangeSet.RangeProcessor<T extends Comparable<T>>The interface exposing a method for processing of ranges.static interfaceThe interface exposing a method for processing raw form of ranges. -
方法概要
修饰符和类型方法说明voidaddOpenClosed(long lowerKey, long lowerValue, long upperKey, long upperValue) Adds the specified range (range that contains all values strictly greater thanlowerand less than or equal toupper.) to thisRangeSet(optional operation).Collection<com.google.common.collect.Range<T>>asRanges()Returns a view of the disconnected ranges that make up this range set.intcardinality(long lowerKey, long lowerValue, long upperKey, long upperValue) Return the number bit sets to true from lower (inclusive) to upper (inclusive).voidclear()booleancontains(long key, long value) Determines whether any of this range set's member ranges containsvalue.com.google.common.collect.Range<T>It returns very first smallest range in the rangeSet.voidforEach(LongPairRangeSet.RangeProcessor<T> action) Performs the given action for each entry in this map until all entries have been processed or action returns "false".voidforEach(LongPairRangeSet.RangeProcessor<T> action, LongPairRangeSet.LongPairConsumer<? extends T> consumer) Performs the given action for each entry in this map until all entries have been processed or action returns "false".voidPerforms the given action for each entry in this map until all entries have been processed or action returns "false".booleanisEmpty()com.google.common.collect.Range<T>It returns very last biggest range in the rangeSet.com.google.common.collect.Range<T>rangeContaining(long key, long value) Returns the unique range from this range set that containsvalue, ornullif this range set does not containvalue.voidremoveAtMost(long key, long value) Remove range that contains all values less than or equal to given key-value.intsize()Returns total number of ranges into the set.com.google.common.collect.Range<T>span()Returns the minimal range which encloses all ranges in this range set.
-
方法详细资料
-
addOpenClosed
void addOpenClosed(long lowerKey, long lowerValue, long upperKey, long upperValue) Adds the specified range (range that contains all values strictly greater thanlowerand less than or equal toupper.) to thisRangeSet(optional operation). That is, for equal range sets a and b, the result ofa.add(range)is thatawill be the minimal range set for which botha.enclosesAll(b)anda.encloses(range).@param lowerKey : value for key of lowerEndpoint of Range @param lowerValue: value for value of lowerEndpoint of Range @param upperKey : value for key of upperEndpoint of Range @param upperValue: value for value of upperEndpoint of Range
-
contains
boolean contains(long key, long value) Determines whether any of this range set's member ranges containsvalue. -
rangeContaining
Returns the unique range from this range set that containsvalue, ornullif this range set does not containvalue. -
removeAtMost
void removeAtMost(long key, long value) Remove range that contains all values less than or equal to given key-value.- 参数:
key-value-
-
isEmpty
boolean isEmpty() -
clear
void clear() -
span
com.google.common.collect.Range<T> span()Returns the minimal range which encloses all ranges in this range set.- 返回:
-
asRanges
Collection<com.google.common.collect.Range<T>> asRanges()Returns a view of the disconnected ranges that make up this range set.- 返回:
-
forEach
Performs the given action for each entry in this map until all entries have been processed or action returns "false". Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.)- 参数:
action-
-
forEach
void forEach(LongPairRangeSet.RangeProcessor<T> action, LongPairRangeSet.LongPairConsumer<? extends T> consumer) Performs the given action for each entry in this map until all entries have been processed or action returns "false". Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.)- 参数:
action-consumer-
-
forEachRawRange
Performs the given action for each entry in this map until all entries have been processed or action returns "false". Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) This method is optimized on reducing intermediate object creation. to do iteration jobs. -
size
int size()Returns total number of ranges into the set.- 返回:
-
firstRange
com.google.common.collect.Range<T> firstRange()It returns very first smallest range in the rangeSet.- 返回:
- first smallest range into the set
-
lastRange
com.google.common.collect.Range<T> lastRange()It returns very last biggest range in the rangeSet.- 返回:
- last biggest range into the set
-
cardinality
int cardinality(long lowerKey, long lowerValue, long upperKey, long upperValue) Return the number bit sets to true from lower (inclusive) to upper (inclusive).
-