Package org.jheaps
Interface AddressableHeap.Handle<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this heapV
- the type of values maintained by this heap
- All Known Subinterfaces:
DoubleEndedAddressableHeap.Handle<K,V>
- 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
decreaseKey(K newKey)
Decrease the key of the element.void
delete()
Delete the element from the heap that it belongs.K
getKey()
Return the key of the element.V
getValue()
Return the value of the element.void
setValue(V value)
Set the value of the element.
-
-
-
Method Detail
-
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 usingAddressableHeap.deleteMin()
.
-
-