This project has retired. For details please refer to its Attic page.
Lucy::Object::BitVector – C API Documentation
Apache Lucy™

Lucy::Object::BitVector

parcel Lucy
class variable LUCY_BITVECTOR
struct symbol lucy_BitVector
class nickname lucy_BitVec
header file Lucy/Object/BitVector.h

Name

Lucy::Object::BitVector – An array of bits.

Description

BitVector is a growable array of bits. All bits are initially zero.

Functions

new
lucy_BitVector* // incremented
lucy_BitVec_new(
    size_t capacity
);

Create a new BitVector.

capacity

The number of bits that the initial array should be able to hold.

init
lucy_BitVector*
lucy_BitVec_init(
    lucy_BitVector *self,
    size_t capacity
);

Initialize a BitVector.

capacity

The number of bits that the initial array should be able to hold.

Methods

Get
bool
lucy_BitVec_Get(
    lucy_BitVector *self,
    size_t tick
);

Return true if the bit at tick has been set, false if it hasn’t (regardless of whether it lies within the bounds of the object’s capacity).

tick

The requested bit.

Set
void
lucy_BitVec_Set(
    lucy_BitVector *self,
    size_t tick
);

Set the bit at tick to 1.

tick

The bit to be set.

Next_Hit
int32_t
lucy_BitVec_Next_Hit(
    lucy_BitVector *self,
    size_t tick
);

Returns the next set bit equal to or greater than tick, or -1 if no such bit exists.

Clear
void
lucy_BitVec_Clear(
    lucy_BitVector *self,
    size_t tick
);

Clear the indicated bit. (i.e. set it to 0).

tick

The bit to be cleared.

Clear_All
void
lucy_BitVec_Clear_All(
    lucy_BitVector *self
);

Clear all bits.

Grow
void
lucy_BitVec_Grow(
    lucy_BitVector *self,
    size_t capacity
);

If the BitVector does not already have enough room to hold the indicated number of bits, allocate more memory so that it can.

capacity

Least number of bits the BitVector should accomodate.

And
void
lucy_BitVec_And(
    lucy_BitVector *self,
    const lucy_BitVector *other
);

Modify the BitVector so that only bits which remain set are those which 1) were already set in this BitVector, and 2) were also set in the other BitVector.

other

Another BitVector.

Or
void
lucy_BitVec_Or(
    lucy_BitVector *self,
    const lucy_BitVector *other
);

Modify the BitVector, setting all bits which are set in the other BitVector if they were not already set.

other

Another BitVector.

Xor
void
lucy_BitVec_Xor(
    lucy_BitVector *self,
    const lucy_BitVector *other
);

Modify the BitVector, performing an XOR operation against the other.

other

Another BitVector.

And_Not
void
lucy_BitVec_And_Not(
    lucy_BitVector *self,
    const lucy_BitVector *other
);

Modify the BitVector, clearing all bits which are set in the other.

other

Another BitVector.

Flip
void
lucy_BitVec_Flip(
    lucy_BitVector *self,
    size_t tick
);

Invert the value of a bit.

tick

The bit to invert.

Flip_Block
void
lucy_BitVec_Flip_Block(
    lucy_BitVector *self,
    size_t offset,
    size_t length
);

Invert each bit within a contiguous block.

offset

Lower bound.

length

The number of bits to flip.

Count
size_t
lucy_BitVec_Count(
    lucy_BitVector *self
);

Return a count of the number of set bits.

To_Array
lucy_I32Array* // incremented
lucy_BitVec_To_Array(
    lucy_BitVector *self
);

Return an array where each element represents a set bit.

Clone
lucy_BitVector* // incremented
lucy_BitVec_Clone(
    lucy_BitVector *self
);

Return a clone of the object.

Inheritance

Lucy::Object::BitVector is a Clownfish::Obj.