public abstract class AbstractIdHashCollection extends java.lang.Object implements IdCollection
Modifier and Type | Field and Description |
---|---|
protected int |
_capacity
The
_table 's capacity |
protected int |
_deleted
The number of cells marked as
DELETED |
protected float |
_overloadFactor
A factor that will be multiplied with the expected number of
elements in order to calculate the capacity
|
protected int |
_size
The number of elements in this collection
|
protected long[] |
_table
The actual table
|
protected static int |
DEFAULT_EXPECTED_SIZE
The default number of expected elements in this collection
|
protected static float |
DEFAULT_LOAD_FACTOR
The default load factor
|
protected static long |
DELETED
A deleted table cell
|
protected static long |
FREE
A free table cell
|
protected static int |
MINIMUM_CAPACITY
The hash table's minimum capacity
|
Constructor and Description |
---|
AbstractIdHashCollection() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all elements from this set
|
protected void |
clearArray(long[] arr)
Clears the given array--i.e. fills it with
FREE values |
protected long[] |
ensureCapacity(int elements)
Ensures that the table can hold a given number of elements.
|
protected int |
hash(long value)
Calculates the hash for a given value
|
protected void |
makeTable(int capacity)
Creates a new, cleared hash table with the given capacity
|
int |
size() |
protected static final int DEFAULT_EXPECTED_SIZE
protected static final float DEFAULT_LOAD_FACTOR
protected static final int MINIMUM_CAPACITY
protected static final long FREE
protected static final long DELETED
protected int _size
protected int _deleted
DELETED
protected float _overloadFactor
protected long[] _table
protected int _capacity
_table
's capacityprotected void clearArray(long[] arr)
FREE
valuesarr
- the array to clearprotected long[] ensureCapacity(int elements)
elements
- the number of expected elementsprotected void makeTable(int capacity)
capacity
- the capacityprotected int hash(long value)
value
- the valuepublic int size()
size
in interface IdCollection
public void clear()
IdCollection
clear
in interface IdCollection