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