public class ConcurrentOpenLongPairRangeSet<T extends Comparable<T>> extends Object implements LongPairRangeSet<T>
LongPair. This can be alternative of
RangeSet and can be used if range type is LongPair
Usage: a. This can be used if one doesn't want to create object for every new insertedrangeb. It createsBitSetfor every unique first-key of the range. So, this rangeSet is not suitable for large number of unique keys.
LongPairRangeSet.DefaultRangeSet<T extends Comparable<T>>, LongPairRangeSet.LongPair, LongPairRangeSet.LongPairConsumer<T>, LongPairRangeSet.RangeProcessor<T extends Comparable<T>>| Modifier and Type | Field and Description |
|---|---|
protected NavigableMap<Long,BitSet> |
rangeBitSetMap |
| Constructor and Description |
|---|
ConcurrentOpenLongPairRangeSet(int size,
boolean threadSafe,
LongPairRangeSet.LongPairConsumer<T> consumer) |
ConcurrentOpenLongPairRangeSet(int size,
LongPairRangeSet.LongPairConsumer<T> consumer) |
ConcurrentOpenLongPairRangeSet(LongPairRangeSet.LongPairConsumer<T> consumer) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(com.google.common.collect.Range<LongPairRangeSet.LongPair> range)
Adds the specified range to this
RangeSet (optional operation). |
void |
addOpenClosed(long lowerKey,
long lowerValueOpen,
long upperKey,
long upperValue)
Adds the specified range to this
RangeSet (optional operation). |
List<com.google.common.collect.Range<T>> |
asRanges()
Returns a view of the disconnected ranges that make up this range set.
|
void |
clear() |
boolean |
contains(long key,
long value)
Determines whether any of this range set's member ranges contains
value. |
boolean |
contains(LongPairRangeSet.LongPair position) |
com.google.common.collect.Range<T> |
firstRange()
It returns very first smallest range in the rangeSet.
|
void |
forEach(LongPairRangeSet.RangeProcessor<T> action)
Performs the given action for each entry in this map until all entries have been processed
or action returns "false".
|
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".
|
boolean |
isEmpty() |
com.google.common.collect.Range<T> |
lastRange()
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 contains
value, or
null if this range set does not contain value. |
void |
remove(com.google.common.collect.Range<LongPairRangeSet.LongPair> range) |
void |
removeAtMost(long key,
long value)
Remove range that contains all values less than or equal to given key-value.
|
int |
size()
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.
|
String |
toString() |
protected final NavigableMap<Long,BitSet> rangeBitSetMap
public ConcurrentOpenLongPairRangeSet(LongPairRangeSet.LongPairConsumer<T> consumer)
public ConcurrentOpenLongPairRangeSet(int size,
LongPairRangeSet.LongPairConsumer<T> consumer)
public ConcurrentOpenLongPairRangeSet(int size,
boolean threadSafe,
LongPairRangeSet.LongPairConsumer<T> consumer)
public void addOpenClosed(long lowerKey,
long lowerValueOpen,
long upperKey,
long upperValue)
RangeSet (optional operation). That is, for equal range sets a and b,
the result of a.add(range) is that a will be the minimal range set for which both
a.enclosesAll(b) and a.encloses(range).
Note that range will merge given range with any ranges in the range set that are
connected with it. Moreover, if range is empty, this is a no-op.
addOpenClosed in interface LongPairRangeSet<T extends Comparable<T>>public boolean contains(long key,
long value)
LongPairRangeSetvalue.contains in interface LongPairRangeSet<T extends Comparable<T>>public com.google.common.collect.Range<T> rangeContaining(long key, long value)
LongPairRangeSetvalue, or
null if this range set does not contain value.rangeContaining in interface LongPairRangeSet<T extends Comparable<T>>public void removeAtMost(long key,
long value)
LongPairRangeSetremoveAtMost in interface LongPairRangeSet<T extends Comparable<T>>public boolean isEmpty()
isEmpty in interface LongPairRangeSet<T extends Comparable<T>>public void clear()
clear in interface LongPairRangeSet<T extends Comparable<T>>public com.google.common.collect.Range<T> span()
LongPairRangeSetspan in interface LongPairRangeSet<T extends Comparable<T>>public List<com.google.common.collect.Range<T>> asRanges()
LongPairRangeSetasRanges in interface LongPairRangeSet<T extends Comparable<T>>public void forEach(LongPairRangeSet.RangeProcessor<T> action)
LongPairRangeSetforEach in interface LongPairRangeSet<T extends Comparable<T>>public void forEach(LongPairRangeSet.RangeProcessor<T> action, LongPairRangeSet.LongPairConsumer<? extends T> consumer)
LongPairRangeSetforEach in interface LongPairRangeSet<T extends Comparable<T>>public com.google.common.collect.Range<T> firstRange()
LongPairRangeSetfirstRange in interface LongPairRangeSet<T extends Comparable<T>>public com.google.common.collect.Range<T> lastRange()
LongPairRangeSetlastRange in interface LongPairRangeSet<T extends Comparable<T>>public int size()
LongPairRangeSetsize in interface LongPairRangeSet<T extends Comparable<T>>public void add(com.google.common.collect.Range<LongPairRangeSet.LongPair> range)
RangeSet (optional operation). That is, for equal range sets a and b,
the result of a.add(range) is that a will be the minimal range set for which both
a.enclosesAll(b) and a.encloses(range).
Note that range will merge given range with any ranges in the range set that are
connected with it. Moreover, if range is empty/invalid, this is a
no-op.
public boolean contains(LongPairRangeSet.LongPair position)
public void remove(com.google.common.collect.Range<LongPairRangeSet.LongPair> range)
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.