# Auto-generated file -- DO NOT EDIT!!!!! =head1 NAME KinoSearch::Object::BitVector - An array of bits. =head1 SYNOPSIS my $bit_vec = KinoSearch::Object::BitVector->new( capacity => 8 ); my $other = KinoSearch::Object::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. =head1 DESCRIPTION An array of bits. BitVector is a growable array of bits. All bits are initially zero. =head1 CONSTRUCTORS =head2 new( I<[labeled params]> ) my $bit_vec = KinoSearch::Object::BitVector->new( capacity => $doc_max + 1, # default 0, ); =over =item * B<capacity> - The number of bits that the initial array should be able to hold. =back =head1 METHODS =head2 get(tick) Return true if the bit at C<< tick >> has been set, false if it hasn't (regardless of whether it lies within the bounds of the object's capacity). =over =item * B<tick> - The requested bit. =back =head2 set(tick) Set the bit at C<< tick >> to 1. =over =item * B<tick> - The bit to be set. =back =head2 clear(tick) Clear the indicated bit. (i.e. set it to 0). =over =item * B<tick> - The bit to be cleared. =back =head2 clear_all() Clear all bits. =head2 and(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. =over =item * B<other> - Another BitVector. =back =head2 or(other) Modify the BitVector, setting all bits which are set in the other BitVector if they were not already set. =over =item * B<other> - Another BitVector. =back =head2 and_not(other) Modify the BitVector, clearing all bits which are set in the other. =over =item * B<other> - Another BitVector. =back =head2 xor(other) Modify the BitVector, performing an XOR operation against the other. =over =item * B<other> - Another BitVector. =back =head2 flip(tick) Invert the value of a bit. =over =item * B<tick> - The bit to invert. =back =head2 flip_block( I<[labeled params]> ) Invert each bit within a contiguous block. =over =item * B<offset> - Lower bound. =item * B<length> - The number of bits to flip. =back =head2 next_set_bit(tick) Returns the next set bit equal to or greater than C<< tick >>, or -1 if no such bit exists. =head2 to_array() Return an array where each element represents a set bit. =head2 grow(capacity) If the BitVector does not already have enough room to hold the indicated number of bits, allocate more memory so that it can. =over =item * B<capacity> - Least number of bits the BitVector should accomodate. =back =head2 count() Return a count of the number of set bits. =head1 INHERITANCE KinoSearch::Object::BitVector isa L<KinoSearch::Object::Obj>. =head1 COPYRIGHT AND LICENSE Copyright 2005-2010 Marvin Humphrey This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut