Package jadex.collection
Class SharedPersistentMap.KVNode
java.lang.Object
jadex.collection.SharedPersistentMap.KVNode
- All Implemented Interfaces:
Map.Entry<K,
V>
- Enclosing class:
SharedPersistentMap<K,
V>
View on a KVNode.
KVNode Layout:
[Prev. Node offset 8 byte]
[Next Node offset 8 byte]
[Key Object Node offset 8 byte]
[Value Object Node offset 8 byte]
-
Constructor Summary
ConstructorsConstructorDescriptionKVNode
(SharedPersistentMap<K, V>.KVNode other) Creates a view on a KV node.KVNode
(MappedByteBuffer buffer) Creates a view on a KV node. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()
Gets the key object.long
Returns the size of the key object.long
getNext()
Gets the position of the next KV node, 0 if end of chain.long
Gets the position of the previous KV node, 0 if start of chain.long
Returns the raw hashcode for the key.getValue()
Gets the value object.long
Returns the size of the value object.boolean
hasNext()
Checks if a next node exists.boolean
Checks if a previous node exists.next()
Selects the next node.protected void
overwriteValue
(V value) Overwrites the value object.previous()
Selects the previous node.protected void
Sets the key object.void
setNext
(long next) Sets a new next KV node position.protected void
setPrevious
(long prev) Sets a new previous KV node position.Sets the value object.
-
Constructor Details
-
KVNode
Creates a view on a KV node.- Parameters:
position
- Position of the KV node.
-
-
Method Details
-
previous
Selects the previous node. Note: This operation changes the node object, current object returned for convenience.- Returns:
- This node.
- Throws:
IOException
- Thrown on IO issues.
-
hasPrevious
Checks if a previous node exists.- Returns:
- True, if there is a previous node.
- Throws:
IOException
- Thrown on IO issues.
-
next
Selects the next node. Note: This operation changes the node object, current object / null returned for convenience.- Returns:
- This node or null if there is no more node.
- Throws:
IOException
- Thrown on IO issues.
-
hasNext
Checks if a next node exists.- Returns:
- True, if there is a next node.
- Throws:
IOException
- Thrown on IO issues.
-
getKey
Gets the key object.- Specified by:
getKey
in interfaceMap.Entry<K,
V> - Returns:
- Key object.
- Throws:
IOException
- Thrown on IO issues.
-
getKeySize
Returns the size of the key object.- Returns:
- Size of the key object.
- Throws:
IOException
- Thrown on IO issues.
-
getValue
Gets the value object.- Specified by:
getValue
in interfaceMap.Entry<K,
V> - Returns:
- Value object.
- Throws:
IOException
- Thrown on IO issues.
-
setValue
Sets the value object.- Specified by:
setValue
in interfaceMap.Entry<K,
V> - Parameters:
value
- Value object.- Returns:
- The previous value.
- Throws:
IOException
- Thrown on IO issues.
-
getValueSize
Returns the size of the value object.- Returns:
- Size of the value object.
- Throws:
IOException
- Thrown on IO issues.
-
getPrevious
Gets the position of the previous KV node, 0 if start of chain.- Returns:
- Position of the previous KV node, 0 if start of chain.
- Throws:
IOException
- Thrown on IO issues.
-
setPrevious
Sets a new previous KV node position.- Parameters:
prev
- New previous KV node position- Throws:
IOException
- Thrown on IO issues.
-
getNext
Gets the position of the next KV node, 0 if end of chain.- Returns:
- Position of the next KV node, 0 if end of chain.
- Throws:
IOException
- Thrown on IO issues.
-
setNext
Sets a new next KV node position.- Parameters:
next
- New next KV node position- Throws:
IOException
- Thrown on IO issues.
-
getRawHash
public long getRawHash()Returns the raw hashcode for the key.- Returns:
- Raw hash code.
-
setKey
Sets the key object.- Parameters:
key
- Key object.- Throws:
IOException
- Thrown on IO issues.
-
overwriteValue
Overwrites the value object.- Parameters:
value
- Value object.- Throws:
IOException
- Thrown on IO issues.
-