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()
PositiveIntSet
clear
in interface PositiveIntSet
public boolean contains(int rawKey)
contains
in interface PositiveIntSet
rawKey
- -public int find(int rawKey)
find
in interface PositiveIntSet
rawKey
- an item which may be in the setpublic boolean add(int rawKey)
add
in interface PositiveIntSet
rawKey
- -public boolean remove(int rawKey)
remove
in interface PositiveIntSet
rawKey
- the value to removepublic int size()
size
in interface PositiveIntSet
public int getMostPositive()
public int getMostNegative()
public void showHistogram()
public int get(int index)
get
in interface PositiveIntSet
index
- - get the element at this position. This is for iterator use only, and is not related to any keypublic IntListIterator iterator()
iterator
in interface PositiveIntSet
public int moveToFirst()
PositiveIntSet
moveToFirst
in interface PositiveIntSet
public int moveToLast()
PositiveIntSet
moveToLast
in interface PositiveIntSet
public int moveToNext(int position)
PositiveIntSet
moveToNext
in interface PositiveIntSet
position
- -public int moveToPrevious(int position)
PositiveIntSet
moveToPrevious
in interface PositiveIntSet
position
- -public boolean isValid(int position)
PositiveIntSet
isValid
in interface PositiveIntSet
position
- -public void bulkAddTo(IntVector v)
PositiveIntSet
bulkAddTo
in interface PositiveIntSet
v
- - to be added topublic int[] toIntArray()
toIntArray
in interface PositiveIntSet
Copyright © 2018. All rights reserved.