Lucene++ - a full-featured, c++ search engine
API Documentation
Optimized implementation of a vector of bits. More...
#include <BitVector.h>
Public Member Functions | |
BitVector (int32_t n=0) | |
Constructs a vector capable of holding n bits. | |
BitVector (ByteArray bits, int32_t size) | |
BitVector (const DirectoryPtr &d, const String &name) | |
Constructs a bit vector from the file name in Directory d, as written by the write method. | |
virtual | ~BitVector () |
virtual String | getClassName () |
boost::shared_ptr< BitVector > | shared_from_this () |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Clone this vector. | |
void | set (int32_t bit) |
Sets the value of bit to one. | |
bool | getAndSet (int32_t bit) |
Sets the value of bit to true, and returns true if bit was already set. | |
void | clear (int32_t bit) |
Sets the value of bit to zero. | |
bool | get (int32_t bit) |
Returns true if bit is one and false if it is zero. | |
int32_t | size () |
Returns the number of bits in this vector. This is also one greater than the number of the largest valid bit number. | |
int32_t | count () |
Returns the total number of one bits in this vector. This is efficiently computed and cached, so that, if the vector is not changed, no recomputation is done for repeated calls. | |
int32_t | getRecomputedCount () |
For testing. | |
void | write (const DirectoryPtr &d, const String &name) |
Writes this vector to the file name in Directory d, in a format that can be read by the constructor BitVector(DirectoryPtr, const String&) . | |
BitVectorPtr | subset (int32_t start, int32_t end) |
Retrieve a subset of this BitVector. | |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. | |
virtual int32_t | hashCode () |
Return hash code for this object. | |
virtual bool | equals (const LuceneObjectPtr &other) |
Return whether two objects are equal. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
virtual String | toString () |
Returns a string representation of the object. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
Protected Member Functions | |
void | writeBits (const IndexOutputPtr &output) |
Write as a bit set. | |
void | writeDgaps (const IndexOutputPtr &output) |
Write as a d-gaps list. | |
bool | isSparse () |
Indicates if the bit vector is sparse and should be saved as a d-gaps list, or dense, and should be saved as a bit set. | |
void | readBits (const IndexInputPtr &input) |
Read as a bit set. | |
void | readDgaps (const IndexInputPtr &input) |
Read as a d-gaps list. | |
![]() | |
LuceneObject () | |
Protected Attributes | |
ByteArray | bits |
int32_t | _size |
int32_t | _count |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
Static Protected Attributes | |
static const uint8_t | BYTE_COUNTS [] |
Optimized implementation of a vector of bits.
Lucene::BitVector::BitVector | ( | int32_t | n = 0 | ) |
Constructs a vector capable of holding n bits.
Lucene::BitVector::BitVector | ( | ByteArray | bits, |
int32_t | size | ||
) |
Lucene::BitVector::BitVector | ( | const DirectoryPtr & | d, |
const String & | name | ||
) |
|
virtual |
|
inlinestatic |
void Lucene::BitVector::clear | ( | int32_t | bit | ) |
Sets the value of bit to zero.
|
virtual |
Clone this vector.
Reimplemented from Lucene::LuceneObject.
int32_t Lucene::BitVector::count | ( | ) |
Returns the total number of one bits in this vector. This is efficiently computed and cached, so that, if the vector is not changed, no recomputation is done for repeated calls.
bool Lucene::BitVector::get | ( | int32_t | bit | ) |
Returns true if bit is one and false if it is zero.
bool Lucene::BitVector::getAndSet | ( | int32_t | bit | ) |
Sets the value of bit to true, and returns true if bit was already set.
|
inlinevirtual |
int32_t Lucene::BitVector::getRecomputedCount | ( | ) |
For testing.
|
protected |
Indicates if the bit vector is sparse and should be saved as a d-gaps list, or dense, and should be saved as a bit set.
|
protected |
Read as a bit set.
|
protected |
Read as a d-gaps list.
void Lucene::BitVector::set | ( | int32_t | bit | ) |
Sets the value of bit to one.
|
inline |
int32_t Lucene::BitVector::size | ( | ) |
Returns the number of bits in this vector. This is also one greater than the number of the largest valid bit number.
BitVectorPtr Lucene::BitVector::subset | ( | int32_t | start, |
int32_t | end | ||
) |
Retrieve a subset of this BitVector.
start | starting index, inclusive |
end | ending index, exclusive |
void Lucene::BitVector::write | ( | const DirectoryPtr & | d, |
const String & | name | ||
) |
Writes this vector to the file name in Directory d, in a format that can be read by the constructor BitVector(DirectoryPtr, const String&)
.
|
protected |
Write as a bit set.
|
protected |
Write as a d-gaps list.
|
protected |
|
protected |
|
protected |
|
staticprotected |