opennlp.tools.util
Class TreeHeap<E>

java.lang.Object
  extended by opennlp.tools.util.TreeHeap<E>
All Implemented Interfaces:
Heap<E>

Deprecated. not used anymore, when there is need for a heap use ListHeap instead

@Deprecated
public class TreeHeap<E>
extends Object
implements Heap<E>

An implementation of the Heap interface based on SortedSet. This implementation will not allow multiple objects which are equal to be added to the heap. Only use this implementation when object in the heap can be totally ordered (no duplicates).


Constructor Summary
TreeHeap()
          Deprecated. Creates a new tree heap.
TreeHeap(int size)
          Deprecated. Creates a new tree heap of the specified size.
 
Method Summary
 void add(E o)
          Deprecated. Adds the specified object to the heap.
 void clear()
          Deprecated. Clears the contents of the heap.
 E extract()
          Deprecated. Removes the smallest element from the heap and returns it.
 E first()
          Deprecated. Returns the smallest element of the heap.
 boolean isEmpty()
          Deprecated. Returns whether the heap is empty.
 Iterator<E> iterator()
          Deprecated. Returns an iterator over the elements of the heap.
 E last()
          Deprecated. Returns the largest element of the heap.
static void main(String[] args)
          Deprecated.  
 int size()
          Deprecated. Returns the size of the heap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeHeap

public TreeHeap()
Deprecated. 
Creates a new tree heap.


TreeHeap

public TreeHeap(int size)
Deprecated. 
Creates a new tree heap of the specified size.

Parameters:
size - The size of the new tree heap.
Method Detail

extract

public E extract()
Deprecated. 
Description copied from interface: Heap
Removes the smallest element from the heap and returns it.

Specified by:
extract in interface Heap<E>
Returns:
The smallest element from the heap.

first

public E first()
Deprecated. 
Description copied from interface: Heap
Returns the smallest element of the heap.

Specified by:
first in interface Heap<E>
Returns:
The top element of the heap.

last

public E last()
Deprecated. 
Description copied from interface: Heap
Returns the largest element of the heap.

Specified by:
last in interface Heap<E>
Returns:
The largest element of the heap.

iterator

public Iterator<E> iterator()
Deprecated. 
Description copied from interface: Heap
Returns an iterator over the elements of the heap. No specific ordering of these elements is guaranteed.

Specified by:
iterator in interface Heap<E>
Returns:
An iterator over the elements of the heap.

add

public void add(E o)
Deprecated. 
Description copied from interface: Heap
Adds the specified object to the heap.

Specified by:
add in interface Heap<E>
Parameters:
o - The object to add to the heap.

size

public int size()
Deprecated. 
Description copied from interface: Heap
Returns the size of the heap.

Specified by:
size in interface Heap<E>
Returns:
The size of the heap.

clear

public void clear()
Deprecated. 
Description copied from interface: Heap
Clears the contents of the heap.

Specified by:
clear in interface Heap<E>

isEmpty

public boolean isEmpty()
Deprecated. 
Description copied from interface: Heap
Returns whether the heap is empty.

Specified by:
isEmpty in interface Heap<E>
Returns:
true if the heap is empty; false otherwise.

main

public static void main(String[] args)
Deprecated. 


Copyright © 2010. All Rights Reserved.