public class SparseFixedBitSet extends BitSet implements Bits, Accountable
i-th
long of the block is non-null, and its offset in the array of longs is
the number of one bits on the right of the i-th
bit.Bits.MatchAllBits, Bits.MatchNoBits
EMPTY_ARRAY
NULL_ACCOUNTABLE
Constructor and Description |
---|
SparseFixedBitSet(int length)
|
Modifier and Type | Method and Description |
---|---|
int |
approximateCardinality()
Return an approximation of the cardinality of this set.
|
int |
cardinality()
Return the number of bits that are set.
|
void |
clear(int i)
Clear the bit at index i.
|
void |
clear(int from,
int to)
Clears a range of bits.
|
boolean |
get(int i)
Returns the value of the bit with the specified
index . |
int |
length()
Returns the number of bits in this set
|
int |
nextSetBit(int i)
Returns the index of the first set bit starting at the index specified.
|
void |
or(DocIdSetIterator it)
Does in-place OR of the bits provided by the iterator.
|
int |
prevSetBit(int i)
Returns the index of the last set bit before or on the index specified.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
void |
set(int i)
Set the bit at index i.
|
String |
toString() |
checkUnpositioned, of
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildResources
public int length()
Bits
public int cardinality()
BitSet
cardinality
in class BitSet
public int approximateCardinality()
BitSet
BitSet.cardinality()
.approximateCardinality
in class BitSet
public boolean get(int i)
Bits
index
.get
in interface Bits
i
- index, should be non-negative and < Bits.length()
.
The result of passing negative or out of bounds values is undefined
by this interface, just don't do it!true
if the bit is set, false
otherwise.public void clear(int from, int to)
BitSet
public int nextSetBit(int i)
BitSet
DocIdSetIterator.NO_MORE_DOCS
is returned if there are no more set bits.nextSetBit
in class BitSet
public int prevSetBit(int i)
BitSet
prevSetBit
in class BitSet
public void or(DocIdSetIterator it) throws IOException
BitSet
or
in class BitSet
IOException
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.