~ubuntu-branches/ubuntu/raring/clucene-core/raring-proposed

« back to all changes in this revision

Viewing changes to src/CLucene/search/HitQueue.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-08-11 09:33:38 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120811093338-fgrx41ftqew3qt6a
Tags: 2.3.3.4-1
* New upstream release (Closes: #661703).
* Convert package to multiarch.
* Drop obsolete patches:
  - 01_add_missing_include_bug505667.diff
  - 02_posixness_fix_bug530308.diff
* Add patches:
  - Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
  - Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
  - Install-contribs-lib.patch
  - multiarch.patch
* Update debian/compat: bump to 8.
* Update debian/control:
  - update build dependencies (add cmake, libboost-dev and libz-dev).
  - bump Standards-Version to 3.9.3.
  - rename packages due to ABI bump: libclucene0ldbl -> libclucene-core1.
  - add libclucene-contribs1 package.
* Update debian/rules:
  - rewrite to use CMake.
  - add multiarch support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*------------------------------------------------------------------------------
2
 
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
3
 
4
 
* Distributable under the terms of either the Apache License (Version 2.0) or 
5
 
* the GNU Lesser General Public License, as specified in the COPYING file.
6
 
------------------------------------------------------------------------------*/
7
 
#ifndef _lucene_search_HitQueue_
8
 
#define _lucene_search_HitQueue_
9
 
 
10
 
#if defined(_LUCENE_PRAGMA_ONCE)
11
 
# pragma once
12
 
#endif
13
 
 
14
 
#include "SearchHeader.h"
15
 
 
16
 
CL_NS_DEF(search)
17
 
 
18
 
/**
19
 
* An optimised PriorityQueue which takes ScoreDoc structs. Some by-ref passing
20
 
* and memory related optimisations have been done.
21
 
*/
22
 
class HitQueue: LUCENE_BASE {
23
 
private:
24
 
        ScoreDoc* heap;
25
 
        size_t _size;
26
 
        size_t maxSize;
27
 
 
28
 
        void upHeap();
29
 
        void downHeap();
30
 
 
31
 
protected:
32
 
        bool lessThan(struct ScoreDoc& hitA, struct ScoreDoc& hitB);
33
 
 
34
 
public:
35
 
        void adjustTop();
36
 
        struct ScoreDoc& top();
37
 
        void put(struct ScoreDoc& element);
38
 
        ScoreDoc pop();
39
 
        /**
40
 
        * Adds element to the PriorityQueue in log(size) time if either
41
 
        * the PriorityQueue is not full, or not lessThan(element, top()).
42
 
        * @param element
43
 
        * @return true if element is added, false otherwise.
44
 
        */
45
 
        bool insert(struct ScoreDoc& element);
46
 
        /**
47
 
        * Returns the number of elements currently stored in the PriorityQueue.
48
 
        */ 
49
 
        size_t size();
50
 
        HitQueue(const int32_t maxSize);
51
 
        ~HitQueue();
52
 
 
53
 
};
54
 
CL_NS_END
55
 
#endif