-
-
04 Sep 2014 00:12:31 UTC
- Distribution: Lucy
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (2 / 91 / 0)
- Kwalitee
Bus factor: 1- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (1.06MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- Clownfish
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Lucy::Object::BitVector - An array of bits.
SYNOPSIS
my $bit_vec = Lucy::Object::BitVector->new( capacity => 8 ); my $other = Lucy::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.
DESCRIPTION
BitVector is a growable array of bits. All bits are initially zero.
CONSTRUCTORS
new( [labeled params] )
my $bit_vec = Lucy::Object::BitVector->new( capacity => $doc_max + 1, # default 0, );
capacity - The number of bits that the initial array should be able to hold.
METHODS
get(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(tick)
Set the bit at
tick
to 1.tick - The bit to be set.
clear(tick)
Clear the indicated bit. (i.e. set it to 0).
tick - The bit to be cleared.
clear_all()
Clear all bits.
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.
other - Another BitVector.
or(other)
Modify the BitVector, setting all bits which are set in the other BitVector if they were not already set.
other - Another BitVector.
and_not(other)
Modify the BitVector, clearing all bits which are set in the other.
other - Another BitVector.
xor(other)
Modify the BitVector, performing an XOR operation against the other.
other - Another BitVector.
flip(tick)
Invert the value of a bit.
tick - The bit to invert.
flip_block( [labeled params] )
Invert each bit within a contiguous block.
offset - Lower bound.
length - The number of bits to flip.
next_hit(tick)
Returns the next set bit equal to or greater than
tick
, or -1 if no such bit exists.to_array()
Return an array where each element represents a set bit.
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.
capacity - Least number of bits the BitVector should accomodate.
count()
Return a count of the number of set bits.
INHERITANCE
Lucy::Object::BitVector isa Clownfish::Obj.
Module Install Instructions
To install Lucy::Simple, copy and paste the appropriate command in to your terminal.
cpanm Lucy::Simple
perl -MCPAN -e shell install Lucy::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.