|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectopennlp.tools.util.TreeHeap
public class TreeHeap
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()
Creates a new tree heap. |
|
TreeHeap(int size)
Creates a new tree heap of the specified size. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Object o)
Adds the specified object to the heap. |
void |
clear()
Clears the contents of the heap. |
java.lang.Object |
extract()
Removes the smallest element from the heap and returns it. |
java.lang.Object |
first()
Returns the smallest element of the heap. |
boolean |
isEmpty()
Returns whether the heap is empty. |
java.util.Iterator |
iterator()
Returns an iterator over the elements of the heap. |
java.lang.Object |
last()
Returns the largest element of the heap. |
static void |
main(java.lang.String[] args)
|
int |
size()
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 |
|---|
public TreeHeap()
public TreeHeap(int size)
size - The size of the new tree heap.| Method Detail |
|---|
public java.lang.Object extract()
Heap
extract in interface Heappublic java.lang.Object first()
Heap
first in interface Heappublic java.lang.Object last()
Heap
last in interface Heappublic java.util.Iterator iterator()
Heap
iterator in interface Heappublic void add(java.lang.Object o)
Heap
add in interface Heapo - The object to add to the heap.public int size()
Heap
size in interface Heappublic void clear()
Heap
clear in interface Heappublic boolean isEmpty()
Heap
isEmpty in interface Heappublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||