Package org.jheaps

Interface AddressableHeap.Handle<K,V>

Type Parameters:
K - the type of keys maintained by this heap
V - the type of values maintained by this heap
All Known Subinterfaces:
DoubleEndedAddressableHeap.Handle<K,V>
All Known Implementing Classes:
AbstractArrayAddressableHeap.ArrayHandle, AbstractRadixAddressableHeap.Node, BinaryTreeAddressableHeap.Node, BinaryTreeSoftAddressableHeap.SoftHandle, CostlessMeldPairingHeap.Node, DaryTreeAddressableHeap.Node, FibonacciHeap.Node, HollowHeap.Item, LeftistHeap.LeftistNode, PairingHeap.Node, RankPairingHeap.Node, ReflectedHeap.ReflectedHandle, SimpleFibonacciHeap.Node, SkewHeap.Node
Enclosing interface:
AddressableHeap<K,V>

public static interface AddressableHeap.Handle<K,V>
A heap element handle. Allows someone to address an element already in a heap and perform additional operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    decreaseKey(K newKey)
    Decrease the key of the element.
    void
    Delete the element from the heap that it belongs.
    Return the key of the element.
    Return the value of the element.
    void
    setValue(V value)
    Set the value of the element.
  • Method Details

    • getKey

      K getKey()
      Return the key of the element.
      Returns:
      the key of the element
    • getValue

      V getValue()
      Return the value of the element.
      Returns:
      the value of the element
    • setValue

      void setValue(V value)
      Set the value of the element.
      Parameters:
      value - the new value
    • decreaseKey

      void decreaseKey(K newKey)
      Decrease the key of the element.
      Parameters:
      newKey - the new key
      Throws:
      IllegalArgumentException - if the new key is larger than the old key according to the comparator used when constructing the heap or the natural ordering of the elements if no comparator was used
    • delete

      void delete()
      Delete the element from the heap that it belongs.
      Throws:
      IllegalArgumentException - in case this function is called twice on the same element or the element has already been deleted using AddressableHeap.deleteMin().