| |
|
| java.lang.Object net.wastl.webmail.misc.StringHeap
StringHeap | public class StringHeap (Code) | | This class is a simple heap structure for sorting Strings lexicographically.
It is mainly used in WebMail for generating a sorted output of Hashkeys.
author: Sebastian Schaffert |
Constructor Summary | |
public | StringHeap(int capacity) |
num_entries | int num_entries(Code) | | |
StringHeap | public StringHeap(int capacity)(Code) | | |
decrease | protected void decrease(int cur_pos)(Code) | | Lower an element in the heap structure
Note that the cur_pos is actually one larger than the position in the array!
|
increase | protected void increase(int cur_pos)(Code) | | Lift an element in the heap structure
Note that the cur_pos is actually one larger than the position in the array!
|
insert | public void insert(String key)(Code) | | Insert a key/value pair
Reorganize Heap afterwards
|
isEmpty | public boolean isEmpty()(Code) | | |
next | public String next()(Code) | | Return and delete the key with the lowest long value. Reorganize Heap.
|
remove | public void remove(String key)(Code) | | Remove an Object from the Heap.
Unfortunately not (yet) of very good complexity since we are doing
a simple linear search here.
Parameters: key - The key to remove from the heap |
|
|
|