Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OpenBitSet.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef OPENBITSET_H
8 #define OPENBITSET_H
9
10 #include "DocIdSet.h"
11
12 namespace Lucene
13 {
19 class LPPAPI OpenBitSet : public DocIdSet
20 {
21 public:
23 OpenBitSet(int64_t numBits = 64);
24
34 OpenBitSet(LongArray bits, int32_t numWords);
35
36 virtual ~OpenBitSet();
37
38 LUCENE_CLASS(OpenBitSet);
39
40 protected:
41 LongArray bits;
42 int32_t wlen; // number of words (elements) used in the array
43
44 public:
45 virtual DocIdSetIteratorPtr iterator();
46
48 virtual bool isCacheable();
49
51 int64_t capacity();
52
55 int64_t size();
56
58 bool isEmpty();
59
61 LongArray getBits();
62
64 void setBits(LongArray bits);
65
67 int32_t getNumWords();
68
70 void setNumWords(int32_t numWords);
71
73 bool get(int32_t index);
74
77 bool fastGet(int32_t index);
78
80 bool get(int64_t index);
81
84 bool fastGet(int64_t index);
85
88 int32_t getBit(int32_t index);
89
91 void set(int64_t index);
92
95 void fastSet(int32_t index);
96
99 void fastSet(int64_t index);
100
104 void set(int64_t startIndex, int64_t endIndex);
105
108 void fastClear(int32_t index);
109
112 void fastClear(int64_t index);
113
115 void clear(int64_t index);
116
120 void clear(int32_t startIndex, int32_t endIndex);
121
125 void clear(int64_t startIndex, int64_t endIndex);
126
129 bool getAndSet(int32_t index);
130
133 bool getAndSet(int64_t index);
134
137 void fastFlip(int32_t index);
138
141 void fastFlip(int64_t index);
142
144 void flip(int64_t index);
145
148 bool flipAndGet(int32_t index);
149
152 bool flipAndGet(int64_t index);
153
157 void flip(int64_t startIndex, int64_t endIndex);
158
160 int64_t cardinality();
161
164 static int64_t intersectionCount(OpenBitSetPtr a, OpenBitSetPtr b);
165
168 static int64_t unionCount(OpenBitSetPtr a, OpenBitSetPtr b);
169
172 static int64_t andNotCount(OpenBitSetPtr a, OpenBitSetPtr b);
173
176 static int64_t xorCount(OpenBitSetPtr a, OpenBitSetPtr b);
177
180 int32_t nextSetBit(int32_t index);
181
184 int64_t nextSetBit(int64_t index);
185
186 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
187
189 void intersect(OpenBitSetPtr other);
190
192 void _union(OpenBitSetPtr other);
193
195 void remove(OpenBitSetPtr other);
196
198 void _xor(OpenBitSetPtr other);
199
201 void _and(OpenBitSetPtr other);
202
204 void _or(OpenBitSetPtr other);
205
207 void andNot(OpenBitSetPtr other);
208
210 bool intersects(OpenBitSetPtr other);
211
214 void ensureCapacityWords(int32_t numWords);
215
218 void ensureCapacity(int64_t numBits);
219
221 void trimTrailingZeros();
222
224 static int32_t bits2words(int64_t numBits);
225
227 virtual bool equals(LuceneObjectPtr other);
228
229 virtual int32_t hashCode();
230
231 protected:
232 int32_t expandingWordNum(int64_t index);
233 };
234 }
235
236 #endif

clucene.sourceforge.net