public class HashSlotArray8byteKeyImpl extends HashSlotArrayBase implements HashSlotArray8byteKey
HashSlotArray8byteKey
as a restriction of HashSlotArrayBase
to a case where just key1
is used.
This class uses the first 8 bytes of the value block for the unassigned sentinel.
It is the responsibility of the caller to ensure that the unassigned sentinel
is overwritten with a non-sentinel value as soon as a new slot is assigned (after calling
ensure(long)
and getting a positive return value).
For the same reason this class must not be instantiated with zero value length. Use
HashSlotArray8byteKeyNoValue
as a zero-length key implementation.
HashSlotArrayBase.Cursor, HashSlotArrayBase.CursorIntKey2, HashSlotArrayBase.CursorLongKey2
CAPACITY_OFFSET, EXPAND_THRESHOLD_OFFSET, HEADER_SIZE, KEY_1_OFFSET, KEY_2_OFFSET, offsetOfUnassignedSentinel, SIZE_OFFSET, slotLength, unassignedSentinel, VALUE_SIZE_GRANULARITY
Modifier | Constructor and Description |
---|---|
protected |
HashSlotArray8byteKeyImpl(long unassignedSentinel,
long offsetOfUnassignedSentinel,
MemoryManager mm,
int valueLength,
int initialCapacity,
float loadFactor) |
|
HashSlotArray8byteKeyImpl(long unassignedSentinel,
MemoryManager mm,
int valueLength) |
|
HashSlotArray8byteKeyImpl(long unassignedSentinel,
MemoryManager mm,
int valueLength,
int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
HashSlotCursor8byteKey |
cursor()
Returns a cursor over all assigned slots in this array.
|
SlotAssignmentResult |
ensure(long key)
Ensures that there is a mapping from the given key to a slot in the array.
|
long |
get(long key)
Returns the address of the value block mapped by the given key.
|
protected long |
key2OfSlot(long baseAddress,
long slot) |
protected long |
keyHash(long key,
long ignored) |
protected void |
putKey(long baseAddress,
long slot,
long key,
long ignored) |
boolean |
remove(long key)
Removes the mapping for the given key.
|
address, allocateArrayAndAdjustFields, assertValid, capacity, clear, dispose, ensure0, equal, expansionThreshold, get0, gotoAddress, gotoNew, isAssigned, key1OfSlot, malloc, markUnassigned, mem, migrateTo, rehash, remove0, resizeTo, setMemMgr, shiftConflictingKeys, size, slotBase, slotHash, trimToSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
address, capacity, clear, expansionThreshold, gotoAddress, gotoNew, size, trimToSize
dispose
public HashSlotArray8byteKeyImpl(long unassignedSentinel, MemoryManager mm, int valueLength, int initialCapacity, float loadFactor)
public HashSlotArray8byteKeyImpl(long unassignedSentinel, MemoryManager mm, int valueLength)
protected HashSlotArray8byteKeyImpl(long unassignedSentinel, long offsetOfUnassignedSentinel, MemoryManager mm, int valueLength, int initialCapacity, float loadFactor)
public SlotAssignmentResult ensure(long key)
Whenever this method returns a newly assigned slot, the caller must ensure that the null-sentinel value at the returned address is overwritten with a non-sentinel value.
ensure
in interface HashSlotArray8byteKey
key
- the keySlotAssignmentResult.isNew()
public long get(long key)
HashSlotArray8byteKey
get
in interface HashSlotArray8byteKey
key
- the keyMemoryAllocator.NULL_ADDRESS
if no mapping for key
exists.public boolean remove(long key)
HashSlotArray8byteKey
remove
in interface HashSlotArray8byteKey
key
- the keypublic HashSlotCursor8byteKey cursor()
HashSlotArray8byteKey
cursor
in interface HashSlotArray8byteKey
protected long key2OfSlot(long baseAddress, long slot)
key2OfSlot
in class HashSlotArrayBase
protected void putKey(long baseAddress, long slot, long key, long ignored)
putKey
in class HashSlotArrayBase
protected long keyHash(long key, long ignored)
keyHash
in class HashSlotArrayBase
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.