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
Modifier and Type | Field and Description |
---|---|
private static long |
BASE_RAM_BYTES_USED |
(package private) long[][] |
bits |
(package private) long[] |
indices |
(package private) int |
length |
private static int |
MASK_4096 |
(package private) int |
nonZeroLongCount |
(package private) long |
ramBytesUsed |
private static long |
SINGLE_ELEMENT_ARRAY_BYTES_USED |
EMPTY_ARRAY
Constructor and Description |
---|
SparseFixedBitSet(int length)
|
Modifier and Type | Method and Description |
---|---|
private void |
and(int i4096,
int i64,
long mask) |
int |
approximateCardinality()
Return an approximation of the cardinality of this set.
|
private static int |
blockCount(int length) |
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.
|
private void |
clearWithinBlock(int i4096,
int from,
int to) |
private boolean |
consistent(int index) |
private int |
firstDoc(int i4096)
Return the first document that occurs on or after the provided block index.
|
boolean |
get(int i)
Returns the value of the bit with the specified
index . |
private void |
insertBlock(int i4096,
int i64,
int i) |
private void |
insertLong(int i4096,
int i64,
int i,
long index) |
private int |
lastDoc(int i4096)
Return the last document that occurs on or before the provided block index.
|
int |
length()
Returns the number of bits in this set
|
private long |
longBits(long index,
long[] bits,
int i64)
Return the long bits at the given
i64 index. |
private static long |
mask(int from,
int to) |
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.
|
private void |
or(int i4096,
long index,
long[] bits,
int nonZeroLongCount) |
private void |
or(SparseFixedBitSet other) |
private void |
orDense(DocIdSetIterator it)
or(DocIdSetIterator) impl that works best when it is dense |
private static int |
oversize(int s) |
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.
|
private void |
removeLong(int i4096,
int i64,
long index,
int o) |
void |
set(int i)
Set the bit at index i.
|
java.lang.String |
toString() |
checkUnpositioned, of
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildResources
private static final long BASE_RAM_BYTES_USED
private static final long SINGLE_ELEMENT_ARRAY_BYTES_USED
private static final int MASK_4096
final long[] indices
final long[][] bits
final int length
int nonZeroLongCount
long ramBytesUsed
private static int blockCount(int length)
public int length()
Bits
private boolean consistent(int index)
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.private static int oversize(int s)
private void insertBlock(int i4096, int i64, int i)
private void insertLong(int i4096, int i64, int i, long index)
private void and(int i4096, int i64, long mask)
private void removeLong(int i4096, int i64, long index, int o)
public void clear(int from, int to)
BitSet
private static long mask(int from, int to)
private void clearWithinBlock(int i4096, int from, int to)
private int firstDoc(int i4096)
public int nextSetBit(int i)
BitSet
DocIdSetIterator.NO_MORE_DOCS
is returned if there are no more set bits.nextSetBit
in class BitSet
private int lastDoc(int i4096)
public int prevSetBit(int i)
BitSet
prevSetBit
in class BitSet
private long longBits(long index, long[] bits, int i64)
i64
index.private void or(int i4096, long index, long[] bits, int nonZeroLongCount)
private void or(SparseFixedBitSet other)
private void orDense(DocIdSetIterator it) throws java.io.IOException
or(DocIdSetIterator)
impl that works best when it
is densejava.io.IOException
public void or(DocIdSetIterator it) throws java.io.IOException
BitSet
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public java.lang.String toString()
toString
in class java.lang.Object