Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.heap
Interface Heap<K extends Comparable<K>,V extends Identifiable>

Type Parameters:
K - Key type
V - Value type
All Superinterfaces:
Serializable
All Known Implementing Classes:
Deap, DefaultHeap, MinMaxHeap, PersistentHeap

public interface Heap<K extends Comparable<K>,V extends Identifiable>
extends Serializable

Encapsulates methods common to all heaps.

Author:
Elke Achtert

Method Summary
 void addNode(HeapNode<K,V> node)
          Adds a node to this heap.
 void flowUp(int index)
          Moves up a node at the specified index until it satisfies the heaporder.
 Integer getIndexOf(V value)
          Returns the current index of the specified value in this heap.
 HeapNode<K,V> getMinNode()
          Retrieves and removes the minimum node of this heap.
 HeapNode<K,V> getNodeAt(int index)
          Returns the node at the specified index.
 boolean isEmpty()
          Indicates whether this heap is empty.
 int size()
          Returns the size of this heap.
 

Method Detail

addNode

void addNode(HeapNode<K,V> node)
Adds a node to this heap.

Parameters:
node - the node to be added

getMinNode

HeapNode<K,V> getMinNode()
Retrieves and removes the minimum node of this heap. If the heap is empty, null will be returned.

Returns:
the minimum node of this heap, null in case of emptiness

isEmpty

boolean isEmpty()
Indicates whether this heap is empty.

Returns:
true if this heap is empty, false otherwise

getIndexOf

Integer getIndexOf(V value)
Returns the current index of the specified value in this heap.

Parameters:
value - the value for which the index should be returned
Returns:
the current index of the specified value in this heap

getNodeAt

HeapNode<K,V> getNodeAt(int index)
Returns the node at the specified index.

Parameters:
index - the index of the node to be returned
Returns:
the node at the specified index

flowUp

void flowUp(int index)
Moves up a node at the specified index until it satisfies the heaporder.

Parameters:
index - the index of the node to be moved up.

size

int size()
Returns the size of this heap.

Returns:
the size of this heap

Release 0.3 (2010-03-31_1612)