de.lmu.ifi.dbs.elki.utilities.datastructures.heap
Class UpdatableHeap<O>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap<O>
              extended by de.lmu.ifi.dbs.elki.utilities.datastructures.heap.UpdatableHeap<O>
Type Parameters:
O - object type
All Implemented Interfaces:
Serializable, Iterable<O>, Collection<O>, Queue<O>

public class UpdatableHeap<O>
extends Heap<O>

A heap as used in OPTICS that allows updating entries.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap
Heap.Itr
 
Field Summary
private  HashMap<O,Integer> index
          Holds the indices in the heap of each element.
private static long serialVersionUID
          Serial version
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap
modCount, size
 
Constructor Summary
UpdatableHeap()
          Simple constructor with default size.
UpdatableHeap(Comparator<? super O> comparator)
          Constructor with comparator
UpdatableHeap(int size)
          Constructor with predefined size.
UpdatableHeap(int size, Comparator<? super O> comparator)
          Constructor with predefined size and comparator
 
Method Summary
 void clear()
           
 boolean offer(O e)
           
 O poll()
           
protected  void putInQueue(int pos, Object e)
          Put an element into the queue at a given position.
protected  O removeAt(int pos)
          Remove the element at the given position.
 O removeObject(O e)
          Remove the given object from the queue.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap
castQueueElement, compare, compareExternal, compareExternalExternal, contains, heapifyDown, heapifyUp, heapifyUpParent, iterator, peek, size, swap, toSortedArrayList
 
Methods inherited from class java.util.AbstractQueue
add, addAll, element, remove
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version

See Also:
Constant Field Values

index

private HashMap<O,Integer> index
Holds the indices in the heap of each element.

Constructor Detail

UpdatableHeap

public UpdatableHeap()
Simple constructor with default size.


UpdatableHeap

public UpdatableHeap(int size)
Constructor with predefined size.

Parameters:
size - Size

UpdatableHeap

public UpdatableHeap(Comparator<? super O> comparator)
Constructor with comparator

Parameters:
comparator - Comparator

UpdatableHeap

public UpdatableHeap(int size,
                     Comparator<? super O> comparator)
Constructor with predefined size and comparator

Parameters:
size - Size
comparator - Comparator
Method Detail

clear

public void clear()
Specified by:
clear in interface Collection<O>
Overrides:
clear in class Heap<O>

offer

public boolean offer(O e)
Specified by:
offer in interface Queue<O>
Overrides:
offer in class Heap<O>

putInQueue

protected void putInQueue(int pos,
                          Object e)
Description copied from class: Heap
Put an element into the queue at a given position. This allows subclasses to index the queue.

Overrides:
putInQueue in class Heap<O>
Parameters:
pos - Index
e - Element

removeAt

protected O removeAt(int pos)
Description copied from class: Heap
Remove the element at the given position.

Overrides:
removeAt in class Heap<O>
Parameters:
pos - Element position.

removeObject

public O removeObject(O e)
Remove the given object from the queue.

Parameters:
e - Obejct to remove
Returns:
Existing entry

poll

public O poll()
Specified by:
poll in interface Queue<O>
Overrides:
poll in class Heap<O>

Release 0.4.0 (2011-09-20_1324)