Class SharedPersistentMap.KVNode

java.lang.Object
jadex.collection.SharedPersistentMap.KVNode
All Implemented Interfaces:
Map.Entry<K,V>
Enclosing class:
SharedPersistentMap<K,V>

protected class SharedPersistentMap.KVNode extends Object implements Map.Entry<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 Details

    • KVNode

      public KVNode(MappedByteBuffer buffer)
      Creates a view on a KV node.
      Parameters:
      position - Position of the KV node.
    • KVNode

      public KVNode(SharedPersistentMap<K,V>.KVNode other)
      Creates a view on a KV node.
      Parameters:
      position - Position of the KV node.
  • Method Details

    • previous

      public SharedPersistentMap<K,V>.KVNode previous() throws IOException
      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

      public boolean hasPrevious() throws IOException
      Checks if a previous node exists.
      Returns:
      True, if there is a previous node.
      Throws:
      IOException - Thrown on IO issues.
    • next

      public SharedPersistentMap<K,V>.KVNode next() throws IOException
      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

      public boolean hasNext() throws IOException
      Checks if a next node exists.
      Returns:
      True, if there is a next node.
      Throws:
      IOException - Thrown on IO issues.
    • getKey

      public K getKey()
      Gets the key object.
      Specified by:
      getKey in interface Map.Entry<K,V>
      Returns:
      Key object.
      Throws:
      IOException - Thrown on IO issues.
    • getKeySize

      public long getKeySize() throws IOException
      Returns the size of the key object.
      Returns:
      Size of the key object.
      Throws:
      IOException - Thrown on IO issues.
    • getValue

      public V getValue()
      Gets the value object.
      Specified by:
      getValue in interface Map.Entry<K,V>
      Returns:
      Value object.
      Throws:
      IOException - Thrown on IO issues.
    • setValue

      public V setValue(V value)
      Sets the value object.
      Specified by:
      setValue in interface Map.Entry<K,V>
      Parameters:
      value - Value object.
      Returns:
      The previous value.
      Throws:
      IOException - Thrown on IO issues.
    • getValueSize

      public long getValueSize() throws IOException
      Returns the size of the value object.
      Returns:
      Size of the value object.
      Throws:
      IOException - Thrown on IO issues.
    • getPrevious

      public long getPrevious() throws IOException
      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

      protected void setPrevious(long prev) throws IOException
      Sets a new previous KV node position.
      Parameters:
      prev - New previous KV node position
      Throws:
      IOException - Thrown on IO issues.
    • getNext

      public long getNext() throws IOException
      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

      public void setNext(long next) throws IOException
      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

      protected void setKey(K key)
      Sets the key object.
      Parameters:
      key - Key object.
      Throws:
      IOException - Thrown on IO issues.
    • overwriteValue

      protected void overwriteValue(V value) throws IOException
      Overwrites the value object.
      Parameters:
      value - Value object.
      Throws:
      IOException - Thrown on IO issues.