public final class BitVector extends Object implements Cloneable, Bits
Bits.MatchAllBits, Bits.MatchNoBits
EMPTY_ARRAY
Constructor and Description |
---|
BitVector(Directory d,
String name)
Constructs a bit vector from the file
name in Directory
d , as written by the write(org.apache.lucene.store.Directory, java.lang.String) method. |
BitVector(int n)
Constructs a vector capable of holding
n bits. |
Modifier and Type | Method and Description |
---|---|
void |
clear(int bit)
Sets the value of
bit to zero. |
Object |
clone() |
int |
count()
Returns the total number of one bits in this vector.
|
boolean |
get(int bit)
Returns
true if bit is one and
false if it is zero. |
boolean |
getAndSet(int bit)
Sets the value of
bit to true, and
returns true if bit was already set |
int |
getRecomputedCount()
For testing
|
int |
length()
Returns the number of bits in this vector.
|
void |
set(int bit)
Sets the value of
bit to one. |
int |
size()
Returns the number of bits in this vector.
|
void |
write(Directory d,
String name)
Writes this vector to the file
name in Directory
d , in a format that can be read by the constructor BitVector(Directory, String) . |
public BitVector(int n)
n
bits.public BitVector(Directory d, String name) throws IOException
name
in Directory
d
, as written by the write(org.apache.lucene.store.Directory, java.lang.String)
method.IOException
public final void set(int bit)
bit
to one.public final boolean getAndSet(int bit)
bit
to true, and
returns true if bit was already setpublic final void clear(int bit)
bit
to zero.public final boolean get(int bit)
true
if bit
is one and
false
if it is zero.public final int size()
public final int length()
public final int count()
public final int getRecomputedCount()
public final void write(Directory d, String name) throws IOException
name
in Directory
d
, in a format that can be read by the constructor BitVector(Directory, String)
.IOException