Package io.usethesource.capsule.core
Class PersistentTrieSet.HashCollisionSetNode<K>
- java.lang.Object
-
- io.usethesource.capsule.core.PersistentTrieSet.AbstractSetNode<K>
-
- io.usethesource.capsule.core.PersistentTrieSet.CompactSetNode<K>
-
- io.usethesource.capsule.core.PersistentTrieSet.HashCollisionSetNode<K>
-
- All Implemented Interfaces:
Node
,SetNode<K,PersistentTrieSet.AbstractSetNode<K>>
,java.io.Serializable
,java.lang.Iterable<K>
- Enclosing class:
- PersistentTrieSet<K>
private static final class PersistentTrieSet.HashCollisionSetNode<K> extends PersistentTrieSet.CompactSetNode<K>
-
-
Field Summary
Fields Modifier and Type Field Description private int
hash
private K[]
keys
-
Fields inherited from class io.usethesource.capsule.core.PersistentTrieSet.CompactSetNode
BIT_PARTITION_MASK, BIT_PARTITION_SIZE, HASH_CODE_LENGTH
-
Fields inherited from class io.usethesource.capsule.core.PersistentTrieSet.AbstractSetNode
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 HashCollisionSetNode(int hash, K[] keys)
-
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
contains(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
(package private) PersistentTrieSet.CompactSetNode<K>
copyAndInsertValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, K key)
(package private) PersistentTrieSet.CompactSetNode<K>
copyAndMigrateFromInlineToNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
(package private) PersistentTrieSet.CompactSetNode<K>
copyAndMigrateFromNodeToInline(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
(package private) PersistentTrieSet.CompactSetNode<K>
copyAndRemoveValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos)
(package private) PersistentTrieSet.CompactSetNode<K>
copyAndSetNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
(package private) int
dataMap()
boolean
equals(java.lang.Object other)
boolean
equivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)
java.util.Optional<K>
findByKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
K
getKey(int index)
int
getKeyHash(int index)
PersistentTrieSet.CompactSetNode<K>
getNode(int index)
(package private) java.lang.Object
getSlot(int index)
int
hashCode()
(package private) boolean
hasNodes()
boolean
hasPayload()
(package private) boolean
hasSlots()
(package private) int
localPayloadHashCode()
(package private) int
nodeArity()
ArrayView<PersistentTrieSet.AbstractSetNode<K>>
nodeArray()
(package private) int
nodeMap()
int
payloadArity()
PersistentTrieSet.AbstractSetNode<K>
removed(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, SetNodeResult<K> details, EqualityComparator<java.lang.Object> cmp)
byte
sizePredicate()
Abstract predicate over a node's size.(package private) int
slotArity()
PersistentTrieSet.AbstractSetNode<K>
updated(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, SetNodeResult<K> details, EqualityComparator<java.lang.Object> cmp)
-
Methods inherited from class io.usethesource.capsule.core.PersistentTrieSet.CompactSetNode
bitpos, dataIndex, index, index, mask, mergeTwoKeyValPairs, nodeAt, nodeIndex, nodeInvariant, nodeOf, nodeOf, nodeOf, nodeOf, nodeOf, recoverMask, toString
-
Methods inherited from class io.usethesource.capsule.core.PersistentTrieSet.AbstractSetNode
dataArray, isAllowedToEdit, iterator, nodeIterator, recursivePayloadHashCode, size, spliterator, stream
-
-
-
-
Field Detail
-
keys
private final K[] keys
-
hash
private final int hash
-
-
Constructor Detail
-
HashCollisionSetNode
HashCollisionSetNode(int hash, K[] keys)
-
-
Method Detail
-
nodeArray
public ArrayView<PersistentTrieSet.AbstractSetNode<K>> nodeArray()
- Specified by:
nodeArray
in interfaceNode
- Specified by:
nodeArray
in classPersistentTrieSet.AbstractSetNode<K>
-
contains
public boolean contains(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
- Specified by:
contains
in interfaceSetNode<K,PersistentTrieSet.AbstractSetNode<K>>
- Overrides:
contains
in classPersistentTrieSet.CompactSetNode<K>
-
findByKey
public java.util.Optional<K> findByKey(K key, int keyHash, int shift, EqualityComparator<java.lang.Object> cmp)
- Specified by:
findByKey
in interfaceSetNode<K,PersistentTrieSet.AbstractSetNode<K>>
- Overrides:
findByKey
in classPersistentTrieSet.CompactSetNode<K>
-
updated
public PersistentTrieSet.AbstractSetNode<K> updated(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, SetNodeResult<K> details, EqualityComparator<java.lang.Object> cmp)
- Specified by:
updated
in interfaceSetNode<K,PersistentTrieSet.AbstractSetNode<K>>
- Overrides:
updated
in classPersistentTrieSet.CompactSetNode<K>
-
removed
public PersistentTrieSet.AbstractSetNode<K> removed(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, K key, int keyHash, int shift, SetNodeResult<K> details, EqualityComparator<java.lang.Object> cmp)
- Specified by:
removed
in interfaceSetNode<K,PersistentTrieSet.AbstractSetNode<K>>
- Overrides:
removed
in classPersistentTrieSet.CompactSetNode<K>
-
hasPayload
public boolean hasPayload()
-
payloadArity
public int payloadArity()
-
hasNodes
boolean hasNodes()
- Specified by:
hasNodes
in classPersistentTrieSet.AbstractSetNode<K>
-
nodeArity
int nodeArity()
- Specified by:
nodeArity
in classPersistentTrieSet.AbstractSetNode<K>
-
arity
int arity()
Description copied from class:PersistentTrieSet.AbstractSetNode
The arity of this trie node (i.e. number of values and nodes stored on this level).- Overrides:
arity
in classPersistentTrieSet.AbstractSetNode<K>
- Returns:
- sum of nodes and values stored within
-
sizePredicate
public byte sizePredicate()
Description copied from interface:Node
- Returns:
- size predicate
-
getKey
public K getKey(int index)
-
getKeyHash
public int getKeyHash(int index)
-
getNode
public PersistentTrieSet.CompactSetNode<K> getNode(int index)
- Specified by:
getNode
in classPersistentTrieSet.CompactSetNode<K>
-
getSlot
java.lang.Object getSlot(int index)
- Specified by:
getSlot
in classPersistentTrieSet.AbstractSetNode<K>
-
hasSlots
boolean hasSlots()
- Specified by:
hasSlots
in classPersistentTrieSet.AbstractSetNode<K>
-
slotArity
int slotArity()
- Specified by:
slotArity
in classPersistentTrieSet.AbstractSetNode<K>
-
localPayloadHashCode
int localPayloadHashCode()
- Specified by:
localPayloadHashCode
in classPersistentTrieSet.AbstractSetNode<K>
-
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)
-
copyAndInsertValue
PersistentTrieSet.CompactSetNode<K> copyAndInsertValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, K key)
- Specified by:
copyAndInsertValue
in classPersistentTrieSet.CompactSetNode<K>
-
copyAndRemoveValue
PersistentTrieSet.CompactSetNode<K> copyAndRemoveValue(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos)
- Specified by:
copyAndRemoveValue
in classPersistentTrieSet.CompactSetNode<K>
-
copyAndSetNode
PersistentTrieSet.CompactSetNode<K> copyAndSetNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
- Specified by:
copyAndSetNode
in classPersistentTrieSet.CompactSetNode<K>
-
copyAndMigrateFromInlineToNode
PersistentTrieSet.CompactSetNode<K> copyAndMigrateFromInlineToNode(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
- Specified by:
copyAndMigrateFromInlineToNode
in classPersistentTrieSet.CompactSetNode<K>
-
copyAndMigrateFromNodeToInline
PersistentTrieSet.CompactSetNode<K> copyAndMigrateFromNodeToInline(java.util.concurrent.atomic.AtomicReference<java.lang.Thread> mutator, int bitpos, PersistentTrieSet.AbstractSetNode<K> node)
- Specified by:
copyAndMigrateFromNodeToInline
in classPersistentTrieSet.CompactSetNode<K>
-
nodeMap
final int nodeMap()
- Specified by:
nodeMap
in classPersistentTrieSet.CompactSetNode<K>
-
dataMap
final int dataMap()
- Specified by:
dataMap
in classPersistentTrieSet.CompactSetNode<K>
-
-