cz.cuni.amis.utils.heap
Interface IHeap<NODE>

Package class diagram package IHeap
Type Parameters:
NODE -
All Superinterfaces:
Collection<NODE>, Iterable<NODE>
All Known Implementing Classes:
Heap, ImmutableHeap

public interface IHeap<NODE>
extends Collection<NODE>

Interface for standard Heap (with addition of decreace/increase/changedKey operations).

We also assume that heap will use Comparator for comparing stored nodes.

Author:
Jimmy

Method Summary
 boolean addAll(NODE[] items)
          Adds all items from 'items'.
 boolean changedKey(NODE node)
          "node" value has been changed (not sure if it was increased or decreased), bubble it through the heap.
 boolean containsAll(Object[] items)
          Whether this heap contains all 'items'.
 boolean decreaseKey(NODE node)
          "node" value has been decreased, bubble it through the heap.
 boolean deleteMin()
          Deletes node with min-value, returns success (true if there was some object in the heap, false if there weren't).
 boolean empty()
          Whether this heap is empty.
 Comparator<NODE> getComparator()
          Returns comparator that is used to compare the nodes in the heap.
 NODE getMin()
          Returns node with min-value from the heap.
 boolean increaseKey(NODE node)
          "node" value has been increased, bubble it through the heap.
 Set<NODE> toSet()
          Returns this heap as a set.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

getComparator

Comparator<NODE> getComparator()
Returns comparator that is used to compare the nodes in the heap.

Returns:

getMin

NODE getMin()
Returns node with min-value from the heap.

Returns:

deleteMin

boolean deleteMin()
Deletes node with min-value, returns success (true if there was some object in the heap, false if there weren't).

Returns:
success

decreaseKey

boolean decreaseKey(NODE node)
"node" value has been decreased, bubble it through the heap.

Parameters:
node -
Returns:

increaseKey

boolean increaseKey(NODE node)
"node" value has been increased, bubble it through the heap.

Parameters:
node -
Returns:

changedKey

boolean changedKey(NODE node)
"node" value has been changed (not sure if it was increased or decreased), bubble it through the heap.

Parameters:
node -
Returns:

addAll

boolean addAll(NODE[] items)
Adds all items from 'items'.

Parameters:
items -
Returns:

containsAll

boolean containsAll(Object[] items)
Whether this heap contains all 'items'.

Parameters:
items -
Returns:

empty

boolean empty()
Whether this heap is empty.

Returns:

toSet

Set<NODE> toSet()
Returns this heap as a set.

Returns:


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.