CLucene - a full-featured, c++ search engine
API Documentation
#include <PriorityQueue.h>

Public Member Functions | |
| virtual | ~PriorityQueue () |
| void | put (_type element) |
| Adds an Object to a PriorityQueue in log(size) time. | |
| bool | insert (_type element) |
| Adds element to the PriorityQueue in log(size) time if either the PriorityQueue is not full, or not lessThan(element, top()). | |
| _type | top () |
| Returns the least element of the PriorityQueue in constant time. | |
| _type | pop () |
| Removes and returns the least element of the PriorityQueue in log(size) time. | |
| void | adjustTop () |
| Should be called when the object at top changes values. | |
| size_t | size () |
| Returns the number of elements currently stored in the PriorityQueue. | |
| void | clear () |
| Removes all entries from the PriorityQueue. | |
Protected Member Functions | |
| PriorityQueue () | |
| virtual bool | lessThan (_type a, _type b)=0 |
| void | initialize (const int32_t maxSize, bool deleteOnClear) |
| lucene::util::PriorityQueue< _type, _valueDeletor >::PriorityQueue | ( | ) | [inline, protected] |
| virtual lucene::util::PriorityQueue< _type, _valueDeletor >::~PriorityQueue | ( | ) | [inline, virtual] |
| void lucene::util::PriorityQueue< _type, _valueDeletor >::adjustTop | ( | ) | [inline] |
Should be called when the object at top changes values.
Still log(n) worst case, but it's at least twice as fast to
{ pq.top().change(); pq.adjustTop(); }
instead of
{ o = pq.pop(); o.change(); pq.push(o); }
| void lucene::util::PriorityQueue< _type, _valueDeletor >::clear | ( | ) | [inline] |
Removes all entries from the PriorityQueue.
| void lucene::util::PriorityQueue< _type, _valueDeletor >::initialize | ( | const int32_t | maxSize, | |
| bool | deleteOnClear | |||
| ) | [inline, protected] |
| bool lucene::util::PriorityQueue< _type, _valueDeletor >::insert | ( | _type | element | ) | [inline] |
Adds element to the PriorityQueue in log(size) time if either the PriorityQueue is not full, or not lessThan(element, top()).
| element |
| virtual bool lucene::util::PriorityQueue< _type, _valueDeletor >::lessThan | ( | _type | a, | |
| _type | b | |||
| ) | [protected, pure virtual] |
| _type lucene::util::PriorityQueue< _type, _valueDeletor >::pop | ( | ) | [inline] |
Removes and returns the least element of the PriorityQueue in log(size) time.
| void lucene::util::PriorityQueue< _type, _valueDeletor >::put | ( | _type | element | ) | [inline] |
Adds an Object to a PriorityQueue in log(size) time.
If one tries to add more objects than maxSize from initialize a RuntimeException (ArrayIndexOutOfBound) is thrown.
| size_t lucene::util::PriorityQueue< _type, _valueDeletor >::size | ( | ) | [inline] |
Returns the number of elements currently stored in the PriorityQueue.
| _type lucene::util::PriorityQueue< _type, _valueDeletor >::top | ( | ) | [inline] |
Returns the least element of the PriorityQueue in constant time.