public class SimpleHasher extends Object implements ArrowBufHasher
This algorithm only provides the most basic semantics for the hash code. That is, if two objects are equal, they must have equal hash code. However, the quality of the produced hash code may not be good. In other words, the generated hash codes are far from being uniformly distributed in the universe.
Therefore, this algorithm is suitable only for scenarios where the most basic semantics of the hash code is required (e.g. in scenarios that require fast and proactive data pruning)
An object of this class is stateless, so it can be shared between threads.
Modifier and Type | Field and Description |
---|---|
static SimpleHasher |
INSTANCE |
Modifier | Constructor and Description |
---|---|
protected |
SimpleHasher() |
Modifier and Type | Method and Description |
---|---|
protected int |
combineHashCode(int currentHashCode,
int newHashCode) |
boolean |
equals(Object obj) |
protected int |
finalizeHashCode(int hashCode) |
protected int |
getLongHashCode(long longValue) |
int |
hashCode() |
int |
hashCode(ArrowBuf buf,
long offset,
long length)
Calculates the hash code for a memory region.
|
int |
hashCode(long address,
long length)
Calculates the hash code for a memory region.
|
public static SimpleHasher INSTANCE
public int hashCode(long address, long length)
hashCode
in interface ArrowBufHasher
address
- start address of the memory region.length
- length of the memory region.public int hashCode(ArrowBuf buf, long offset, long length)
hashCode
in interface ArrowBufHasher
buf
- the buffer for the memory region.offset
- offset within the buffer for the memory region.length
- length of the memory region.protected int combineHashCode(int currentHashCode, int newHashCode)
protected int getLongHashCode(long longValue)
protected int finalizeHashCode(int hashCode)
Copyright © 2023 The Apache Software Foundation. All rights reserved.