|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.emory.mathcs.util.collections.ints.AbstractIntCollection
edu.emory.mathcs.util.collections.ints.AbstractIntSet
edu.emory.mathcs.util.collections.ints.AbstractIntSortedSet
edu.emory.mathcs.util.collections.ints.IntIntervalSet
Set of int 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 int as they form clusters (int 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.ints.AbstractIntSortedSet |
AbstractIntSortedSet.AbstractComplementSubView, AbstractIntSortedSet.AbstractSubView, AbstractIntSortedSet.ForwardIntervalItemIterator, AbstractIntSortedSet.ReverseIntervalItemIterator |
Constructor Summary | |
IntIntervalSet()
Creates a new set of ints. |
|
IntIntervalSet(IntCollection c)
|
|
IntIntervalSet(int min,
int max)
|
|
IntIntervalSet(IntSet c)
|
Method Summary | |
boolean |
add(int n)
Adds an element to the set if it is not already present. |
boolean |
addAll(IntCollection 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(int first,
int last)
Adds to this set all the numbers between first and last, inclusive, that are not already present in this set and beint to this set's domain. |
int |
ceiling(int n)
Returns the smallest number in this set >= e. |
IntInterval |
ceilingInterval(int 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. |
IntSet |
complementSet()
Returns a complement view of this set. |
boolean |
contains(int n)
Checks whether the set contains a given element |
boolean |
containsInterval(int first,
int 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. |
IntIterator |
descendingIterator()
Returns an iterator over numbers in this set, in a decreasing numerical order. |
IntInterval |
enclosingInterval(int 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. |
int |
first()
Returns the smallest number in this set. |
IntInterval |
firstInterval()
Returns the first (left-most), widest interval contained in this set, or null if this set is empty. |
int |
floor(int n)
Returns the largest number in this set <= e. |
IntInterval |
floorInterval(int n)
Returns the largest (right-most), widest interval contained in this set which elements are not all greater than the specified number. |
int |
higher(int n)
Returns the smallest number in this set > e. |
IntInterval |
higherInterval(int 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. |
IntIterator |
iterator()
Returns an iterator over numbers in this set, in an increasing numerical order. |
int |
last()
Returns the largest number in this set. |
IntInterval |
lastInterval()
Returns the last (right-most), widest interval contained in this set, or null if this set is empty. |
int |
lower(int n)
Returns the largest number in this set < e. |
IntInterval |
lowerInterval(int n)
Returns the largest and widest interval contained in this set which all elements are strictly less than the specified number. |
int |
max()
The largest number that can be stored in this set. |
int |
min()
The smallest number that can be stored in this set. |
int |
pollFirst()
Returns and removes the smallest number in this set. |
IntInterval |
pollFirstInterval()
Returns and removes the first (left-most), widest interval contained in this set, or null if this set is empty. |
int |
pollLast()
Returns and removes the largest number in this set. |
IntInterval |
pollLastInterval()
Returns and removes the last (right-most), widest interval contained in this set, or null if this set is empty. |
boolean |
remove(int n)
Removes the specified number from this set if it is present. |
boolean |
removeAll(IntCollection c)
Removes from this set all of its elements that are contained in the specified collection. |
boolean |
removeInterval(int first,
int last)
Removes from this set all the numbers between first and last, inclusive. |
int |
size64()
Returns the number of elements in this set. |
IntSortedSet |
subSet(int first,
int 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.ints.AbstractIntSortedSet |
headSet, retainAll, retainInterval, tailSet, toCompactString |
Methods inherited from class edu.emory.mathcs.util.collections.ints.AbstractIntSet |
equals, hashCode |
Methods inherited from class edu.emory.mathcs.util.collections.ints.AbstractIntCollection |
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.ints.IntSortedSet |
toString |
Methods inherited from interface edu.emory.mathcs.util.collections.ints.IntSet |
containsAll, equals, hashCode, size, toArray, toArray |
Constructor Detail |
public IntIntervalSet()
public IntIntervalSet(int min, int max)
public IntIntervalSet(IntCollection c)
public IntIntervalSet(IntSet c)
Method Detail |
public int min()
IntSet
min
in interface IntSet
min
in class AbstractIntSet
public int max()
IntSet
max
in interface IntSet
max
in class AbstractIntSet
public int intervalCount()
IntSortedSet
intervalCount
in interface IntSortedSet
intervalCount
in class AbstractIntSortedSet
public int size64()
IntSet
size64
in interface IntSet
size64
in class AbstractIntSortedSet
public boolean isEmpty()
IntSet
isEmpty
in interface IntSet
isEmpty
in class AbstractIntSortedSet
public void clear()
clear
in interface IntSet
clear
in class AbstractIntCollection
public boolean add(int n)
add
in interface IntSet
add
in class AbstractIntCollection
public boolean addInterval(int first, int last)
IntSet
addInterval
in interface IntSet
addInterval
in class AbstractIntSet
public boolean addAll(IntCollection c)
IntSet
addAll
in interface IntSet
addAll
in class AbstractIntSet
public boolean remove(int n)
IntSet
remove
in interface IntSet
remove
in class AbstractIntCollection
public boolean removeInterval(int first, int last)
IntSet
removeInterval
in interface IntSet
removeInterval
in class AbstractIntSet
public boolean removeAll(IntCollection c)
IntSet
removeAll
in interface IntSet
removeAll
in class AbstractIntSet
public boolean contains(int n)
contains
in interface IntSet
contains
in class AbstractIntCollection
n
- the element
public boolean containsInterval(int first, int last)
IntSet
containsInterval
in interface IntSet
containsInterval
in class AbstractIntSet
public IntInterval enclosingInterval(int e)
IntSortedSet
enclosingInterval
in interface IntSortedSet
public int lower(int n)
IntSortedSet
lower
in interface IntSortedSet
lower
in class AbstractIntSortedSet
public int floor(int n)
IntSortedSet
floor
in interface IntSortedSet
floor
in class AbstractIntSortedSet
public int higher(int n)
IntSortedSet
higher
in interface IntSortedSet
higher
in class AbstractIntSortedSet
public int ceiling(int n)
IntSortedSet
ceiling
in interface IntSortedSet
ceiling
in class AbstractIntSortedSet
public java.util.Iterator intervalIterator()
IntSortedSet
intervalIterator
in interface IntSortedSet
public IntIterator iterator()
IntSortedSet
iterator
in interface IntSortedSet
iterator
in class AbstractIntSortedSet
public java.util.Iterator descendingIntervalIterator()
IntSortedSet
descendingIntervalIterator
in interface IntSortedSet
public IntIterator descendingIterator()
IntSortedSet
descendingIterator
in interface IntSortedSet
descendingIterator
in class AbstractIntSortedSet
public int first()
IntSortedSet
first
in interface IntSortedSet
first
in class AbstractIntSortedSet
public int last()
IntSortedSet
last
in interface IntSortedSet
last
in class AbstractIntSortedSet
public int pollFirst()
IntSortedSet
pollFirst
in interface IntSortedSet
pollFirst
in class AbstractIntSortedSet
public int pollLast()
IntSortedSet
pollLast
in interface IntSortedSet
pollLast
in class AbstractIntSortedSet
public IntInterval firstInterval()
IntSortedSet
firstInterval
in interface IntSortedSet
firstInterval
in class AbstractIntSortedSet
public IntInterval lastInterval()
IntSortedSet
lastInterval
in interface IntSortedSet
lastInterval
in class AbstractIntSortedSet
public IntInterval ceilingInterval(int n)
IntSortedSet
ceilingInterval
in interface IntSortedSet
public IntInterval floorInterval(int n)
IntSortedSet
floorInterval
in interface IntSortedSet
public IntInterval higherInterval(int n)
IntSortedSet
higherInterval
in interface IntSortedSet
public IntInterval lowerInterval(int n)
IntSortedSet
lowerInterval
in interface IntSortedSet
public IntInterval pollFirstInterval()
IntSortedSet
pollFirstInterval
in interface IntSortedSet
pollFirstInterval
in class AbstractIntSortedSet
public IntInterval pollLastInterval()
IntSortedSet
pollLastInterval
in interface IntSortedSet
pollLastInterval
in class AbstractIntSortedSet
public IntSortedSet subSet(int first, int last)
IntSortedSet
subSet
in interface IntSortedSet
first
- the minimum element of this view (inclusive).last
- the maximum element of this view (inclusive).
public IntSet complementSet()
IntSet
complementSet
in interface IntSet
complementSet
in class AbstractIntSet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |