Class LongPairRangeSet.DefaultRangeSet<T extends Comparable<T>>
java.lang.Object
org.apache.pulsar.common.util.collections.LongPairRangeSet.DefaultRangeSet<T>
- Type Parameters:
T- the type of values in ranges.
- All Implemented Interfaces:
LongPairRangeSet<T>
- Enclosing interface:
- LongPairRangeSet<T extends Comparable<T>>
public static class LongPairRangeSet.DefaultRangeSet<T extends Comparable<T>>
extends Object
implements LongPairRangeSet<T>
Generic implementation of a default range set.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.pulsar.common.util.collections.LongPairRangeSet
LongPairRangeSet.DefaultRangeSet<T extends Comparable<T>>, LongPairRangeSet.LongPair, LongPairRangeSet.LongPairConsumer<T>, LongPairRangeSet.RangeProcessor<T extends Comparable<T>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOpenClosed(long key1, long value1, long key2, long value2) Adds the specified range (range that contains all values strictly greater thanlowerand less than or equal toupper.) to thisRangeSet(optional operation).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.booleancom.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".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.com.google.common.collect.Range<T>rangeContaining(T position) voidvoidremoveAtMost(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.toString()
-
Constructor Details
-
DefaultRangeSet
-
-
Method Details
-
clear
public void clear()- Specified by:
clearin interfaceLongPairRangeSet<T extends Comparable<T>>
-
addOpenClosed
public void addOpenClosed(long key1, long value1, long key2, long value2) Description copied from interface:LongPairRangeSetAdds 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
- Specified by:
addOpenClosedin interfaceLongPairRangeSet<T extends Comparable<T>>
-
contains
-
rangeContaining
-
rangeContaining
Description copied from interface:LongPairRangeSetReturns the unique range from this range set that containsvalue, ornullif this range set does not containvalue.- Specified by:
rangeContainingin interfaceLongPairRangeSet<T extends Comparable<T>>
-
remove
-
removeAtMost
public void removeAtMost(long key, long value) Description copied from interface:LongPairRangeSetRemove range that contains all values less than or equal to given key-value.- Specified by:
removeAtMostin interfaceLongPairRangeSet<T extends Comparable<T>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceLongPairRangeSet<T extends Comparable<T>>
-
span
Description copied from interface:LongPairRangeSetReturns the minimal range which encloses all ranges in this range set.- Specified by:
spanin interfaceLongPairRangeSet<T extends Comparable<T>>- Returns:
-
asRanges
Description copied from interface:LongPairRangeSetReturns a view of the disconnected ranges that make up this range set.- Specified by:
asRangesin interfaceLongPairRangeSet<T extends Comparable<T>>- Returns:
-
forEach
Description copied from interface:LongPairRangeSetPerforms 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.)- Specified by:
forEachin interfaceLongPairRangeSet<T extends Comparable<T>>
-
forEach
public void forEach(LongPairRangeSet.RangeProcessor<T> action, LongPairRangeSet.LongPairConsumer<? extends T> consumer) Description copied from interface:LongPairRangeSetPerforms 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.)- Specified by:
forEachin interfaceLongPairRangeSet<T extends Comparable<T>>
-
contains
public boolean contains(long key, long value) Description copied from interface:LongPairRangeSetDetermines whether any of this range set's member ranges containsvalue.- Specified by:
containsin interfaceLongPairRangeSet<T extends Comparable<T>>
-
firstRange
Description copied from interface:LongPairRangeSetIt returns very first smallest range in the rangeSet.- Specified by:
firstRangein interfaceLongPairRangeSet<T extends Comparable<T>>- Returns:
- first smallest range into the set
-
lastRange
Description copied from interface:LongPairRangeSetIt returns very last biggest range in the rangeSet.- Specified by:
lastRangein interfaceLongPairRangeSet<T extends Comparable<T>>- Returns:
- last biggest range into the set
-
cardinality
public int cardinality(long lowerKey, long lowerValue, long upperKey, long upperValue) Description copied from interface:LongPairRangeSetReturn the number bit sets to true from lower (inclusive) to upper (inclusive).- Specified by:
cardinalityin interfaceLongPairRangeSet<T extends Comparable<T>>
-
size
public int size()Description copied from interface:LongPairRangeSetReturns total number of ranges into the set.- Specified by:
sizein interfaceLongPairRangeSet<T extends Comparable<T>>- Returns:
-
toString
-