org.graffiti.plugins.algorithms.mst
Class ArrayHeap<E,K>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by org.graffiti.plugins.algorithms.mst.AbstractHeap<E,K>
          extended by org.graffiti.plugins.algorithms.mst.ArrayHeap<E,K>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Heap<E,K>

public class ArrayHeap<E,K>
extends AbstractHeap<E,K>


Constructor Summary
ArrayHeap()
           
 
Method Summary
 Heap.Entry<E,K> add(E element, K key)
          Adds the specified element with the specified key to this heap; returns a new heap entry to enable clients to modify the element's key.
 void clear()
           
 Comparator<? super K> comparator()
          Returns the comparator of this heap or null if this heap uses the natural ordering of its elements.
 Collection<Heap.Entry<E,K>> entries()
          Returns a collection view of the entries of this heap.
 E getPeek()
          Returns the peek (i.e.
 E removePeek()
          Removes the peek (i.e.
 
Methods inherited from class org.graffiti.plugins.algorithms.mst.AbstractHeap
add, iterator, size
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ArrayHeap

public ArrayHeap()
Method Detail

comparator

public Comparator<? super K> comparator()
Description copied from interface: Heap
Returns the comparator of this heap or null if this heap uses the natural ordering of its elements.

Specified by:
comparator in interface Heap<E,K>
Specified by:
comparator in class AbstractHeap<E,K>
Returns:
the comparator of this heap or null if this heap uses the natural ordering of its elements.

clear

public void clear()
Specified by:
clear in interface Collection<E>
Overrides:
clear in class AbstractCollection<E>

add

public Heap.Entry<E,K> add(E element,
                           K key)
Description copied from interface: Heap
Adds the specified element with the specified key to this heap; returns a new heap entry to enable clients to modify the element's key.

Specified by:
add in interface Heap<E,K>
Overrides:
add in class AbstractHeap<E,K>
Parameters:
element - the element to be added to this heap
key - the key to be associated with the specified element
Returns:
a new heap entry to enable clients to modify the element's key.

getPeek

public E getPeek()
Description copied from interface: Heap
Returns the peek (i.e. smallest) element of this heap according to the order specified by this heap's comparator or the natural order of its elements if this heap's comparator is null.

Specified by:
getPeek in interface Heap<E,K>
Overrides:
getPeek in class AbstractHeap<E,K>
Returns:
the peek (i.e. smallest) element of this heap according to the order specified by this heap's comparator or the natural order of its elements if this heap's comparator is null.
See Also:
Heap.comparator()

removePeek

public E removePeek()
Description copied from interface: Heap
Removes the peek (i.e. smallest) element from this heap.

Specified by:
removePeek in interface Heap<E,K>
Overrides:
removePeek in class AbstractHeap<E,K>
Returns:
the peek (i.e. smallest) element of this heap.

entries

public Collection<Heap.Entry<E,K>> entries()
Description copied from interface: Heap
Returns a collection view of the entries of this heap. The returned collection supports remove but does not support add.

Specified by:
entries in interface Heap<E,K>
Specified by:
entries in class AbstractHeap<E,K>
Returns:
a collection view of the entries of this heap.


Generated at 2012-05-30 11:01:25 PM CEST