public final class FixedBitSet extends DocIdSet implements Bits
getBits()
) long[], accessed with an int index,
implementing Bits and DocIdSet. Unlike OpenBitSet
this bit set does not auto-expand, cannot
handle long index, and does not have fastXX/XX variants
(just X).Bits.MatchAllBits, Bits.MatchNoBits
EMPTY_DOCIDSET
EMPTY_ARRAY
Constructor and Description |
---|
FixedBitSet(FixedBitSet other)
Makes full copy.
|
FixedBitSet(int numBits) |
Modifier and Type | Method and Description |
---|---|
void |
and(DocIdSetIterator iter)
Does in-place AND of the bits provided by the
iterator.
|
void |
and(FixedBitSet other)
this = this AND other
|
void |
andNot(DocIdSetIterator iter)
Does in-place AND NOT of the bits provided by the
iterator.
|
void |
andNot(FixedBitSet other)
this = this AND NOT other
|
static int |
bits2words(int numBits)
returns the number of 64 bit words it would take to hold numBits
|
int |
cardinality()
Returns number of set bits.
|
void |
clear(int index) |
void |
clear(int startIndex,
int endIndex)
Clears a range of bits.
|
Object |
clone() |
boolean |
equals(Object o)
returns true if both sets have the same bits set
|
void |
flip(int startIndex,
int endIndex)
Flips a range of bits
|
boolean |
get(int index) |
boolean |
getAndClear(int index) |
boolean |
getAndSet(int index) |
long[] |
getBits()
Expert.
|
int |
hashCode() |
boolean |
isCacheable()
This DocIdSet implementation is cacheable.
|
DocIdSetIterator |
iterator()
Provides a
DocIdSetIterator to access the set. |
int |
length() |
int |
nextSetBit(int index)
Returns the index of the first set bit starting at the index specified
|
void |
or(DocIdSetIterator iter)
Does in-place OR of the bits provided by the
iterator.
|
void |
or(FixedBitSet other)
this = this OR other
|
int |
prevSetBit(int index)
Returns the index of the last set bit before or on the index specified
|
void |
set(int index) |
void |
set(int startIndex,
int endIndex)
Sets a range of bits
|
public FixedBitSet(int numBits)
public FixedBitSet(FixedBitSet other)
public static int bits2words(int numBits)
public DocIdSetIterator iterator()
DocIdSet
DocIdSetIterator
to access the set.
This implementation can return null
or
DocIdSet.EMPTY_DOCIDSET.iterator()
if there
are no docs that match.public boolean isCacheable()
isCacheable
in class DocIdSet
public long[] getBits()
public int cardinality()
public void set(int index)
public boolean getAndSet(int index)
public void clear(int index)
public boolean getAndClear(int index)
public int nextSetBit(int index)
public int prevSetBit(int index)
public void or(DocIdSetIterator iter) throws IOException
IOException
public void or(FixedBitSet other)
public void and(DocIdSetIterator iter) throws IOException
IOException
public void and(FixedBitSet other)
public void andNot(DocIdSetIterator iter) throws IOException
IOException
public void andNot(FixedBitSet other)
public void flip(int startIndex, int endIndex)
startIndex
- lower indexendIndex
- one-past the last bit to flippublic void set(int startIndex, int endIndex)
startIndex
- lower indexendIndex
- one-past the last bit to setpublic void clear(int startIndex, int endIndex)
startIndex
- lower indexendIndex
- one-past the last bit to clearpublic boolean equals(Object o)