Package io.usethesource.capsule.core
Class PersistentTrieMap.HashCollisionMapNode<K,V>
- java.lang.Object
-
- io.usethesource.capsule.core.PersistentTrieMap.AbstractMapNode<K,V>
-
- io.usethesource.capsule.core.PersistentTrieMap.CompactMapNode<K,V>
-
- io.usethesource.capsule.core.PersistentTrieMap.HashCollisionMapNode<K,V>
-
- All Implemented Interfaces:
MapNode<K,V,PersistentTrieMap.AbstractMapNode<K,V>>
,Node
,java.io.Serializable
- Enclosing class:
- PersistentTrieMap<K,V>
private static final class PersistentTrieMap.HashCollisionMapNode<K,V> extends PersistentTrieMap.CompactMapNode<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private int
hash
private K[]
keys
private V[]
vals
-
Fields inherited from class io.usethesource.capsule.core.PersistentTrieMap.CompactMapNode
BIT_PARTITION_MASK, BIT_PARTITION_SIZE, HASH_CODE_LENGTH
-
Fields inherited from class io.usethesource.capsule.core.PersistentTrieMap.AbstractMapNode
TUPLE_LENGTH
-
Fields inherited from interface io.usethesource.capsule.core.trie.Node
SIZE_EMPTY, SIZE_MORE_THAN_ONE, SIZE_ONE
-
-
Constructor Summary
Constructors Constructor Description HashCollisionMapNode(int hash, K[] keys, V[] vals)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
arity()
The arity of this trie node (i.e.boolean
containsKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndInsertValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, K key, V val)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndMigrateFromInlineToNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndMigrateFromNodeToInline(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndRemoveValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndSetNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
(package private) PersistentTrieMap.CompactMapNode<K,V>
copyAndSetValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, V val)
(package private) int
dataMap()
boolean
equals(java.lang.Object other)
boolean
equivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)
java.util.Optional<V>
findByKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
(package private) K
getKey(int index)
(package private) java.util.Map.Entry<K,V>
getKeyValueEntry(int index)
PersistentTrieMap.CompactMapNode<K,V>
getNode(int index)
(package private) java.lang.Object
getSlot(int index)
(package private) V
getValue(int index)
int
hashCode()
(package private) boolean
hasNodes()
(package private) boolean
hasPayload()
(package private) boolean
hasSlots()
(package private) int
nodeArity()
ArrayView<PersistentTrieMap.AbstractMapNode<K,V>>
nodeArray()
(package private) int
nodeMap()
(package private) int
payloadArity()
PersistentTrieMap.AbstractMapNode<K,V>
removed(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, MapNodeResult<K,V> details, EqualityComparator<java.lang.Object> cmp)
byte
sizePredicate()
Abstract predicate over a node's size.(package private) int
slotArity()
PersistentTrieMap.AbstractMapNode<K,V>
updated(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, V val, int keyHash, int shift, MapNodeResult<K,V> details, EqualityComparator<java.lang.Object> cmp)
-
Methods inherited from class io.usethesource.capsule.core.PersistentTrieMap.CompactMapNode
bitpos, dataIndex, index, index, mask, mergeTwoKeyValPairs, nodeAt, nodeIndex, nodeInvariant, nodeOf, nodeOf, nodeOf, recoverMask, toString
-
Methods inherited from class io.usethesource.capsule.core.PersistentTrieMap.AbstractMapNode
dataArray, isAllowedToEdit, nodeIterator, size
-
-
-
-
Method Detail
-
nodeArray
public ArrayView<PersistentTrieMap.AbstractMapNode<K,V>> nodeArray()
-
containsKey
public boolean containsKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
- Specified by:
containsKey
in interfaceMapNode<K,V,PersistentTrieMap.AbstractMapNode<K,V>>
- Overrides:
containsKey
in classPersistentTrieMap.CompactMapNode<K,V>
-
findByKey
public java.util.Optional<V> findByKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
-
updated
public PersistentTrieMap.AbstractMapNode<K,V> updated(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, V val, int keyHash, int shift, MapNodeResult<K,V> details, EqualityComparator<java.lang.Object> cmp)
-
removed
public PersistentTrieMap.AbstractMapNode<K,V> removed(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, MapNodeResult<K,V> details, EqualityComparator<java.lang.Object> cmp)
-
hasPayload
boolean hasPayload()
- Specified by:
hasPayload
in classPersistentTrieMap.AbstractMapNode<K,V>
-
payloadArity
int payloadArity()
- Specified by:
payloadArity
in classPersistentTrieMap.AbstractMapNode<K,V>
-
hasNodes
boolean hasNodes()
- Specified by:
hasNodes
in classPersistentTrieMap.AbstractMapNode<K,V>
-
nodeArity
int nodeArity()
- Specified by:
nodeArity
in classPersistentTrieMap.AbstractMapNode<K,V>
-
arity
int arity()
Description copied from class:PersistentTrieMap.AbstractMapNode
The arity of this trie node (i.e. number of values and nodes stored on this level).- Overrides:
arity
in classPersistentTrieMap.AbstractMapNode<K,V>
- Returns:
- sum of nodes and values stored within
-
sizePredicate
public byte sizePredicate()
Description copied from interface:Node
- Returns:
- size predicate
-
getKey
K getKey(int index)
- Specified by:
getKey
in classPersistentTrieMap.AbstractMapNode<K,V>
-
getValue
V getValue(int index)
- Specified by:
getValue
in classPersistentTrieMap.AbstractMapNode<K,V>
-
getKeyValueEntry
java.util.Map.Entry<K,V> getKeyValueEntry(int index)
- Specified by:
getKeyValueEntry
in classPersistentTrieMap.AbstractMapNode<K,V>
-
getNode
public PersistentTrieMap.CompactMapNode<K,V> getNode(int index)
- Specified by:
getNode
in classPersistentTrieMap.CompactMapNode<K,V>
-
getSlot
java.lang.Object getSlot(int index)
- Specified by:
getSlot
in classPersistentTrieMap.AbstractMapNode<K,V>
-
hasSlots
boolean hasSlots()
- Specified by:
hasSlots
in classPersistentTrieMap.AbstractMapNode<K,V>
-
slotArity
int slotArity()
- Specified by:
slotArity
in classPersistentTrieMap.AbstractMapNode<K,V>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
equivalent
public boolean equivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)
-
copyAndSetValue
PersistentTrieMap.CompactMapNode<K,V> copyAndSetValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, V val)
- Specified by:
copyAndSetValue
in classPersistentTrieMap.CompactMapNode<K,V>
-
copyAndInsertValue
PersistentTrieMap.CompactMapNode<K,V> copyAndInsertValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, K key, V val)
- Specified by:
copyAndInsertValue
in classPersistentTrieMap.CompactMapNode<K,V>
-
copyAndRemoveValue
PersistentTrieMap.CompactMapNode<K,V> copyAndRemoveValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos)
- Specified by:
copyAndRemoveValue
in classPersistentTrieMap.CompactMapNode<K,V>
-
copyAndSetNode
PersistentTrieMap.CompactMapNode<K,V> copyAndSetNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
- Specified by:
copyAndSetNode
in classPersistentTrieMap.CompactMapNode<K,V>
-
copyAndMigrateFromInlineToNode
PersistentTrieMap.CompactMapNode<K,V> copyAndMigrateFromInlineToNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
- Specified by:
copyAndMigrateFromInlineToNode
in classPersistentTrieMap.CompactMapNode<K,V>
-
copyAndMigrateFromNodeToInline
PersistentTrieMap.CompactMapNode<K,V> copyAndMigrateFromNodeToInline(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieMap.AbstractMapNode<K,V> node)
- Specified by:
copyAndMigrateFromNodeToInline
in classPersistentTrieMap.CompactMapNode<K,V>
-
nodeMap
int nodeMap()
- Specified by:
nodeMap
in classPersistentTrieMap.CompactMapNode<K,V>
-
dataMap
int dataMap()
- Specified by:
dataMap
in classPersistentTrieMap.CompactMapNode<K,V>
-
-