Package org.apache.lucene.util
Class CombinedBitSet
- java.lang.Object
-
- org.apache.lucene.util.BitSet
-
- org.apache.lucene.util.CombinedBitSet
-
- All Implemented Interfaces:
Accountable,Bits
public final class CombinedBitSet extends BitSet implements Bits
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.lucene.util.Bits
Bits.MatchAllBits, Bits.MatchNoBits
-
-
Field Summary
-
Fields inherited from interface org.apache.lucene.util.Bits
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description CombinedBitSet(BitSet first, Bits second)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intapproximateCardinality()Return an approximation of the cardinality of this set.intcardinality()This implementation is slow and requires to iterate over all bits to compute the intersection.voidclear(int i)Clear the bit ati.voidclear(int startIndex, int endIndex)Clears a range of bits.booleanget(int index)Returns the value of the bit with the specifiedindex.BitSetgetFirst()intlength()Returns the number of bits in this setintnextSetBit(int index)Returns the index of the first set bit starting at the index specified.intprevSetBit(int index)Returns the index of the last set bit before or on the index specified.longramBytesUsed()Return the memory usage of this object in bytes.voidset(int i)Set the bit ati.-
Methods inherited from class org.apache.lucene.util.BitSet
checkUnpositioned, of, or
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Method Detail
-
getFirst
public BitSet getFirst()
-
cardinality
public int cardinality()
This implementation is slow and requires to iterate over all bits to compute the intersection. UseapproximateCardinality()for a fast approximation.- Specified by:
cardinalityin classBitSet
-
approximateCardinality
public int approximateCardinality()
Description copied from class:BitSetReturn an approximation of the cardinality of this set. Some implementations may trade accuracy for speed if they have the ability to estimate the cardinality of the set without iterating over all the data. The default implementation returnsBitSet.cardinality().- Overrides:
approximateCardinalityin classBitSet
-
prevSetBit
public int prevSetBit(int index)
Description copied from class:BitSetReturns the index of the last set bit before or on the index specified. -1 is returned if there are no more set bits.- Specified by:
prevSetBitin classBitSet
-
nextSetBit
public int nextSetBit(int index)
Description copied from class:BitSetReturns the index of the first set bit starting at the index specified.DocIdSetIterator.NO_MORE_DOCSis returned if there are no more set bits.- Specified by:
nextSetBitin classBitSet
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
get
public boolean get(int index)
Description copied from interface:BitsReturns the value of the bit with the specifiedindex.- Specified by:
getin interfaceBits- Parameters:
index- 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!- Returns:
trueif the bit is set,falseotherwise.
-
length
public int length()
Description copied from interface:BitsReturns the number of bits in this set
-
set
public void set(int i)
Description copied from class:BitSetSet the bit ati.
-
clear
public void clear(int i)
Description copied from class:BitSetClear the bit ati.
-
-