KinoSearch::Util::BitVector - An array of bits.
my $bit_vec = KinoSearch::Util::BitVector->new( capacity => 8 );
my $other = KinoSearch::Util::BitVector->new( capacity => 8 );
$bit_vec->set($_) for ( 0, 2, 4, 6 );
$other->set($_) for ( 1, 3, 5, 7 );
$bit_vec->or($other);
print "$_\n" for @{ $bit_vec->to_array }; # prints 0 through 7.
BitVector is a growable array of bits. All bits are initially zero.
my $bit_vec = KinoSearch::Util::BitVector->new(
capacity => $max_docs + 1, # default 0,
);
Return true if the bit indicated has been set, false if it hasn't. (Regardless of whether it lies within the bounds of the object's capacity).
Set the indicated bit at to 1.
Clear the indicated bit. (i.e. set it to 0).
Clear all bits.
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.
Modify the BitVector, setting all bits which are set in the other BitVector if they were not already set.
Modify the BitVector, clearing all bits which are set in the other.
Modify the BitVector, performing an XOR operation against the other.
Invert the value of a bit.
Invert each bit within a contiguous block.
Returns the next set bit equal to or greater than the supplied tick, or -1 if no such bit exists.
Return an array where each element represents a set bit.
If the BitVector does not already have enough room to hold the indicated number of bits, allocate more memory so that it can.
Return a count of the number of set bits.
Duplicate the contents of another BitVector.
KinoSearch::Util::BitVector isa KinoSearch::Obj.
Copyright 2005-2008 Marvin Humphrey
See KinoSearch version 0.20.