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

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

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Lucene::BitVector Class Reference

Optimized implementation of a vector of bits. More...

`#include <BitVector.h>`

Inheritance diagram for Lucene::BitVector:

## Public Member Functions

| BitVector (int32_t n=0)
| Constructs a vector capable of holding n bits. More...
| 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. More...
virtual | ~BitVector ()
virtual String | getClassName ()
boost::shared_ptr< BitVector > | shared_from_this ()
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Clone this vector. More...
void | set (int32_t bit)
| Sets the value of bit to one. More...
bool | getAndSet (int32_t bit)
| Sets the value of bit to true, and returns true if bit was already set. More...
void | clear (int32_t bit)
| Sets the value of bit to zero. More...
bool | get (int32_t bit)
| Returns true if bit is one and false if it is zero. More...
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. More...
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. More...
int32_t | getRecomputedCount ()
| For testing. More...
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&). More...
BitVectorPtr | subset (int32_t start, int32_t end)
| Retrieve a subset of this BitVector. More...
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects. More...
virtual String | toString ()
| Returns a string representation of the object. More...
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock. More...
virtual LuceneSignalPtr | getSignal ()
| Return this object signal. More...
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout. More...
virtual void | unlock ()
| Unlock this object. More...
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread. More...
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout. More...
virtual void | notifyAll ()
| Notify all threads waiting for signal. More...

## Static Public Member Functions

static String | _getClassName ()

## Protected Member Functions

void | writeBits (const IndexOutputPtr &output)
| Write as a bit set. More...
void | writeDgaps (const IndexOutputPtr &output)
| Write as a d-gaps list. More...
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. More...
void | readBits (const IndexInputPtr &input)
| Read as a bit set. More...
void | readDgaps (const IndexInputPtr &input)
| Read as a d-gaps list. More...
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Protected Attributes

ByteArray | bits
int32_t | _size
int32_t | _count
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Static Protected Attributes

static const uint8_t | BYTE_COUNTS []

## Detailed Description

Optimized implementation of a vector of bits.

## Constructor & Destructor Documentation

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
| ) |  |

Constructs a bit vector from the file name in Directory d, as written by the write method.

virtual Lucene::BitVector::~BitVector | ( |  | ) |

virtual

## Member Function Documentation

static String Lucene::BitVector::_getClassName | ( |  | ) |

inline static

void Lucene::BitVector::clear | ( | int32_t | bit | ) |

Sets the value of bit to zero.

virtual LuceneObjectPtr Lucene::BitVector::clone | ( | const LuceneObjectPtr & | other = `LuceneObjectPtr()` | ) |

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.

virtual String Lucene::BitVector::getClassName | ( |  | ) |

inline virtual

int32_t Lucene::BitVector::getRecomputedCount | ( |  | ) |

For testing.

bool Lucene::BitVector::isSparse | ( |  | ) |

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.

void Lucene::BitVector::readBits | ( | const IndexInputPtr & | input | ) |

protected

Read as a bit set.

void Lucene::BitVector::readDgaps | ( | const IndexInputPtr & | input | ) |

protected

Read as a d-gaps list.

void Lucene::BitVector::set | ( | int32_t | bit | ) |

Sets the value of bit to one.

boost::shared_ptr< BitVector > Lucene::BitVector::shared_from_this | ( |  | ) |

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.

Parameters

  start | starting index, inclusive
  end | ending index, exclusive

Returns
  subset

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&).

void Lucene::BitVector::writeBits | ( | const IndexOutputPtr & | output | ) |

protected

Write as a bit set.

void Lucene::BitVector::writeDgaps | ( | const IndexOutputPtr & | output | ) |

protected

Write as a d-gaps list.

## Field Documentation

int32_t Lucene::BitVector::_count

protected

int32_t Lucene::BitVector::_size

protected

ByteArray Lucene::BitVector::bits

protected

const uint8_t Lucene::BitVector::BYTE_COUNTS[]

static protected

The documentation for this class was generated from the following file:

- BitVector.h

clucene.sourceforge.net