|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.emory.mathcs.util.collections.longs.AbstractLongCollection
edu.emory.mathcs.util.collections.longs.AbstractLongSet
edu.emory.mathcs.util.collections.longs.AbstractLongSortedSet
edu.emory.mathcs.util.collections.longs.LongIntervalSet
Set of long numbers that is optimized towards clustered distributions. The implementation keeps the atomic information about intervals of numbers, hence this set can hold billions of elements as long as they form clusters (long consecutive runs). The main application of this class is in collision detection arrays, e.g. to aid in generation of unique IDs that are roughly sequential but possibly cyclic (process IDs, packet IDs) with ID recycling and gap filling.
Caution: descending iterators aren't particularly well tested.
Nested Class Summary |
Nested classes inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSortedSet |
AbstractLongSortedSet.AbstractComplementSubView, AbstractLongSortedSet.AbstractSubView, AbstractLongSortedSet.ForwardIntervalItemIterator, AbstractLongSortedSet.ReverseIntervalItemIterator |
Constructor Summary | |
LongIntervalSet()
Creates a new set of longs. |
|
LongIntervalSet(LongCollection c)
|
|
LongIntervalSet(long min,
long max)
|
|
LongIntervalSet(LongSet c)
|
Method Summary | |
boolean |
add(long n)
Adds an element to the set if it is not already present. |
boolean |
addAll(LongCollection c)
Adds all of the elements in the specified collection to this set if they're not already present, and if they fall within this set's domain. |
boolean |
addInterval(long first,
long last)
Adds to this set all the numbers between first and last, inclusive, that are not already present in this set and belong to this set's domain. |
long |
ceiling(long n)
Returns the smallest number in this set >= e. |
LongInterval |
ceilingInterval(long n)
Returns the smallest (left-most), widest interval contained in this set which elements are not all smaller than the specified number. |
void |
clear()
Removes all elements from the set. |
LongSet |
complementSet()
Returns a complement view of this set. |
boolean |
contains(long n)
Checks whether the set contains a given element |
boolean |
containsInterval(long first,
long last)
Returns true if this set contains all the numbers between first and last, inclusive; false otherwise. |
java.util.Iterator |
descendingIntervalIterator()
Returns an iterator over intervals of this set, in a decreasing numerical order. |
LongIterator |
descendingIterator()
Returns an iterator over numbers in this set, in a decreasing numerical order. |
LongInterval |
enclosingInterval(long e)
Returns the widest interval contained in this set that includes the specified number, or null if this set does not include the specified number. |
long |
first()
Returns the smallest number in this set. |
LongInterval |
firstInterval()
Returns the first (left-most), widest interval contained in this set, or null if this set is empty. |
long |
floor(long n)
Returns the largest number in this set <= e. |
LongInterval |
floorInterval(long n)
Returns the largest (right-most), widest interval contained in this set which elements are not all greater than the specified number. |
long |
higher(long n)
Returns the smallest number in this set > e. |
LongInterval |
higherInterval(long n)
Returns the smallest (left-most), widest interval contained in this set which all elements are strictly greater than the specified number. |
int |
intervalCount()
Returns the minimum count of intervals into which this set can be decomposed. |
java.util.Iterator |
intervalIterator()
Returns an iterator over intervals of this set, in an increasing numerical order. |
boolean |
isEmpty()
Returns true if this set is empty; false otherwise. |
LongIterator |
iterator()
Returns an iterator over numbers in this set, in an increasing numerical order. |
long |
last()
Returns the largest number in this set. |
LongInterval |
lastInterval()
Returns the last (right-most), widest interval contained in this set, or null if this set is empty. |
long |
lower(long n)
Returns the largest number in this set < e. |
LongInterval |
lowerInterval(long n)
Returns the largest and widest interval contained in this set which all elements are strictly less than the specified number. |
long |
max()
The largest number that can be stored in this set. |
long |
min()
The smallest number that can be stored in this set. |
long |
pollFirst()
Returns and removes the smallest number in this set. |
LongInterval |
pollFirstInterval()
Returns and removes the first (left-most), widest interval contained in this set, or null if this set is empty. |
long |
pollLast()
Returns and removes the largest number in this set. |
LongInterval |
pollLastInterval()
Returns and removes the last (right-most), widest interval contained in this set, or null if this set is empty. |
boolean |
remove(long n)
Removes the specified number from this set if it is present. |
boolean |
removeAll(LongCollection c)
Removes from this set all of its elements that are contained in the specified collection. |
boolean |
removeInterval(long first,
long last)
Removes from this set all the numbers between first and last, inclusive. |
long |
size64()
// PREPROC: Long,Int only Returns the number of elements in this set. |
LongSortedSet |
subSet(long first,
long last)
A subset view containing all elements from this set between first, inclusive, and last, inclusive. |
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSortedSet |
headSet, retainAll, retainInterval, tailSet, toCompactString |
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSet |
equals, hashCode |
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongCollection |
containsAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.emory.mathcs.util.collections.longs.LongSortedSet |
toString |
Methods inherited from interface edu.emory.mathcs.util.collections.longs.LongSet |
containsAll, equals, hashCode, size, toArray, toArray |
Constructor Detail |
public LongIntervalSet()
public LongIntervalSet(long min, long max)
public LongIntervalSet(LongCollection c)
public LongIntervalSet(LongSet c)
Method Detail |
public long min()
LongSet
min
in interface LongSet
min
in class AbstractLongSet
public long max()
LongSet
max
in interface LongSet
max
in class AbstractLongSet
public int intervalCount()
LongSortedSet
intervalCount
in interface LongSortedSet
intervalCount
in class AbstractLongSortedSet
public long size64()
LongSet
size64
in interface LongSet
size64
in class AbstractLongSortedSet
public boolean isEmpty()
LongSet
isEmpty
in interface LongSet
isEmpty
in class AbstractLongSortedSet
public void clear()
clear
in interface LongSet
clear
in class AbstractLongCollection
public boolean add(long n)
add
in interface LongSet
add
in class AbstractLongCollection
public boolean addInterval(long first, long last)
LongSet
addInterval
in interface LongSet
addInterval
in class AbstractLongSet
public boolean addAll(LongCollection c)
LongSet
addAll
in interface LongSet
addAll
in class AbstractLongSet
public boolean remove(long n)
LongSet
remove
in interface LongSet
remove
in class AbstractLongCollection
public boolean removeInterval(long first, long last)
LongSet
removeInterval
in interface LongSet
removeInterval
in class AbstractLongSet
public boolean removeAll(LongCollection c)
LongSet
removeAll
in interface LongSet
removeAll
in class AbstractLongSet
public boolean contains(long n)
contains
in interface LongSet
contains
in class AbstractLongCollection
n
- the element
public boolean containsInterval(long first, long last)
LongSet
containsInterval
in interface LongSet
containsInterval
in class AbstractLongSet
public LongInterval enclosingInterval(long e)
LongSortedSet
enclosingInterval
in interface LongSortedSet
public long lower(long n)
LongSortedSet
lower
in interface LongSortedSet
lower
in class AbstractLongSortedSet
public long floor(long n)
LongSortedSet
floor
in interface LongSortedSet
floor
in class AbstractLongSortedSet
public long higher(long n)
LongSortedSet
higher
in interface LongSortedSet
higher
in class AbstractLongSortedSet
public long ceiling(long n)
LongSortedSet
ceiling
in interface LongSortedSet
ceiling
in class AbstractLongSortedSet
public java.util.Iterator intervalIterator()
LongSortedSet
intervalIterator
in interface LongSortedSet
public LongIterator iterator()
LongSortedSet
iterator
in interface LongSortedSet
iterator
in class AbstractLongSortedSet
public java.util.Iterator descendingIntervalIterator()
LongSortedSet
descendingIntervalIterator
in interface LongSortedSet
public LongIterator descendingIterator()
LongSortedSet
descendingIterator
in interface LongSortedSet
descendingIterator
in class AbstractLongSortedSet
public long first()
LongSortedSet
first
in interface LongSortedSet
first
in class AbstractLongSortedSet
public long last()
LongSortedSet
last
in interface LongSortedSet
last
in class AbstractLongSortedSet
public long pollFirst()
LongSortedSet
pollFirst
in interface LongSortedSet
pollFirst
in class AbstractLongSortedSet
public long pollLast()
LongSortedSet
pollLast
in interface LongSortedSet
pollLast
in class AbstractLongSortedSet
public LongInterval firstInterval()
LongSortedSet
firstInterval
in interface LongSortedSet
firstInterval
in class AbstractLongSortedSet
public LongInterval lastInterval()
LongSortedSet
lastInterval
in interface LongSortedSet
lastInterval
in class AbstractLongSortedSet
public LongInterval ceilingInterval(long n)
LongSortedSet
ceilingInterval
in interface LongSortedSet
public LongInterval floorInterval(long n)
LongSortedSet
floorInterval
in interface LongSortedSet
public LongInterval higherInterval(long n)
LongSortedSet
higherInterval
in interface LongSortedSet
public LongInterval lowerInterval(long n)
LongSortedSet
lowerInterval
in interface LongSortedSet
public LongInterval pollFirstInterval()
LongSortedSet
pollFirstInterval
in interface LongSortedSet
pollFirstInterval
in class AbstractLongSortedSet
public LongInterval pollLastInterval()
LongSortedSet
pollLastInterval
in interface LongSortedSet
pollLastInterval
in class AbstractLongSortedSet
public LongSortedSet subSet(long first, long last)
LongSortedSet
subSet
in interface LongSortedSet
first
- the minimum element of this view (inclusive).last
- the maximum element of this view (inclusive).
public LongSet complementSet()
LongSet
complementSet
in interface LongSet
complementSet
in class AbstractLongSet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |