|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.HashCommon
public class HashCommon
Common code for all hash-based classes.
Field Summary | |
---|---|
static Object |
REMOVED
This reference is used to fill keys and values of removed entries (if they are objects). |
Method Summary | |
---|---|
static int |
arraySize(int expected,
float f)
Returns the least power of two smaller than or equal to 230 and larger than or equal to Math.ceil( expected / f ) . |
static long |
bigArraySize(long expected,
float f)
Returns the least power of two larger than or equal to Math.ceil( expected / f ) . |
static int |
double2int(double d)
Returns the hash code that would be returned by Double.hashCode() . |
static int |
float2int(float f)
Returns the hash code that would be returned by Float.hashCode() . |
static int |
long2int(long l)
Returns the hash code that would be returned by Long.hashCode() . |
static int |
maxFill(int n,
float f)
Returns the maximum number of entries that can be filled before rehashing. |
static long |
maxFill(long n,
float f)
Returns the maximum number of entries that can be filled before rehashing. |
static int |
murmurHash3(int x)
Avalanches the bits of an integer by applying the finalisation step of MurmurHash3. |
static long |
murmurHash3(long x)
Avalanches the bits of a long integer by applying the finalisation step of MurmurHash3. |
static int |
nextPowerOfTwo(int x)
Return the least power of two greater than or equal to the specified value. |
static long |
nextPowerOfTwo(long x)
Return the least power of two greater than or equal to the specified value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object REMOVED
null
cannot be used as it would confuse the
search algorithm in the presence of an actual null
key.
Method Detail |
---|
public static final int murmurHash3(int x)
This function implements the finalisation step of Austin Appleby's MurmurHash3.
Its purpose is to avalanche the bits of the argument to within 0.25% bias. It is used, among other things, to scramble quickly (but deeply) the hash
values returned by Object.hashCode()
.
x
- an integer.
public static final long murmurHash3(long x)
This function implements the finalisation step of Austin Appleby's MurmurHash3.
Its purpose is to avalanche the bits of the argument to within 0.25% bias. It is used, among other things, to scramble quickly (but deeply) the hash
values returned by Object.hashCode()
.
x
- a long integer.
public static final int float2int(float f)
Float.hashCode()
.
new Float(f).hashCode()
.public static final int double2int(double d)
Double.hashCode()
.
new Double(f).hashCode()
.public static final int long2int(long l)
Long.hashCode()
.
new Long(f).hashCode()
.public static int nextPowerOfTwo(int x)
Note that this function will return 1 when the argument is 0.
x
- an integer smaller than or equal to 230.
public static long nextPowerOfTwo(long x)
Note that this function will return 1 when the argument is 0.
x
- a long integer smaller than or equal to 262.
public static int maxFill(int n, float f)
n
- the size of the backing array.f
- the load factor.
public static long maxFill(long n, float f)
n
- the size of the backing array.f
- the load factor.
public static int arraySize(int expected, float f)
Math.ceil( expected / f )
.
expected
- the expected number of elements in a hash table.f
- the load factor.
IllegalArgumentException
- if the necessary size is larger than 230.public static long bigArraySize(long expected, float f)
Math.ceil( expected / f )
.
expected
- the expected number of elements in a hash table.f
- the load factor.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |