public class IntHashSet extends Object implements PositiveIntSet
| Modifier and Type | Field and Description |
|---|---|
static float |
DEFAULT_LOAD_FACTOR |
static int |
SIZE_NEEDING_4_BYTES |
| Constructor and Description |
|---|
IntHashSet() |
IntHashSet(int initialCapacity) |
IntHashSet(int initialCapacity,
int offset) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int rawKey) |
void |
bulkAddTo(IntVector v)
add all elements in this set to the IntVector v as a bulk operation
|
void |
clear()
remove all members of the set
|
boolean |
contains(int rawKey) |
int |
find(int rawKey) |
int |
get(int index)
For iterator use, position is a magic number returned by the internal find
For short keys, the value stored for adjKey == 0 is -1, adjKey == -1 is -2, etc.
|
int |
getMostNegative() |
int |
getMostPositive() |
static int |
getSpaceOverheadInWords() |
int |
getSpaceUsedInWords() |
boolean |
isValid(int position)
For FSBagIndex low level iterator use
|
IntListIterator |
iterator() |
int |
moveToFirst()
For FSBagIndex low level iterator use
|
int |
moveToLast()
For FSBagIndex low level iterator use
|
int |
moveToNext(int position)
For FSBagIndex low level iterator use
|
int |
moveToPrevious(int position)
For FSBagIndex low level iterator use
|
boolean |
remove(int rawKey)
mostPositive and mostNegative are not updated
for removes.
|
void |
showHistogram() |
int |
size() |
int |
tableSpace(int numberOfElements)
The number of 32 bit words that are reserved when
creating a table to hold the specified number of elements
The number is a power of 2.
|
static int |
tableSpace(int numberOfElements,
Float factor) |
int[] |
toIntArray() |
String |
toString() |
boolean |
wontExpand() |
boolean |
wontExpand(int n) |
public static final int SIZE_NEEDING_4_BYTES
public static final float DEFAULT_LOAD_FACTOR
public IntHashSet()
public IntHashSet(int initialCapacity)
public IntHashSet(int initialCapacity,
int offset)
initialCapacity - - you can add this many before expansionoffset - - for values in the short range, the amount to subtract
before storing.
If == MIN_VALUE, then force 4 byte intspublic int tableSpace(int numberOfElements)
numberOfElements - -public static int tableSpace(int numberOfElements,
Float factor)
numberOfElements - -factor - -public boolean wontExpand()
public boolean wontExpand(int n)
public int getSpaceUsedInWords()
public static int getSpaceOverheadInWords()
public void clear()
PositiveIntSetclear in interface PositiveIntSetpublic boolean contains(int rawKey)
contains in interface PositiveIntSetrawKey - -public int find(int rawKey)
find in interface PositiveIntSetrawKey - an item which may be in the setpublic boolean add(int rawKey)
add in interface PositiveIntSetrawKey - -public boolean remove(int rawKey)
remove in interface PositiveIntSetrawKey - the value to removepublic int size()
size in interface PositiveIntSetpublic int getMostPositive()
public int getMostNegative()
public void showHistogram()
public int get(int index)
get in interface PositiveIntSetindex - - get the element at this position. This is for iterator use only, and is not related to any keypublic IntListIterator iterator()
iterator in interface PositiveIntSetpublic int moveToFirst()
PositiveIntSetmoveToFirst in interface PositiveIntSetpublic int moveToLast()
PositiveIntSetmoveToLast in interface PositiveIntSetpublic int moveToNext(int position)
PositiveIntSetmoveToNext in interface PositiveIntSetposition - -public int moveToPrevious(int position)
PositiveIntSetmoveToPrevious in interface PositiveIntSetposition - -public boolean isValid(int position)
PositiveIntSetisValid in interface PositiveIntSetposition - -public void bulkAddTo(IntVector v)
PositiveIntSetbulkAddTo in interface PositiveIntSetv - - to be added topublic int[] toIntArray()
toIntArray in interface PositiveIntSetCopyright © 2018. All rights reserved.