Class FixedBitSet
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public sealed class FixedBitSet : DocIdSet, IBits
Constructors
FixedBitSet(int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public FixedBitSet(int numBits)
Parameters
Type | Name | Description |
---|---|---|
int | numBits |
FixedBitSet(long[], int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public FixedBitSet(long[] storedBits, int numBits)
Parameters
Type | Name | Description |
---|---|---|
long[] | storedBits | |
int | numBits |
Properties
Bits
Optionally provides a IBits interface for random access to matching documents.
Declaration
public override IBits Bits { get; }
Property Value
Type | Description |
---|---|
IBits |
|
Overrides
Cardinality
Gets the number of set bits. NOTE: this visits every long in the backing bits array, and the result is not internally cached!
Declaration
public int Cardinality { get; }
Property Value
Type | Description |
---|---|
int |
IsCacheable
This DocIdSet implementation is cacheable.
Declaration
public override bool IsCacheable { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Length
Returns the number of bits in this set
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int |
Methods
And(DocIdSetIterator)
Does in-place AND of the bits provided by the iterator.
Declaration
public void And(DocIdSetIterator iter)
Parameters
Type | Name | Description |
---|---|---|
DocIdSetIterator | iter |
And(FixedBitSet)
this = this AND other
Declaration
public void And(FixedBitSet other)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | other |
AndNot(DocIdSetIterator)
Does in-place AND NOT of the bits provided by the iterator.
Declaration
public void AndNot(DocIdSetIterator iter)
Parameters
Type | Name | Description |
---|---|---|
DocIdSetIterator | iter |
AndNot(FixedBitSet)
this = this AND NOT other
Declaration
public void AndNot(FixedBitSet other)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | other |
AndNotCount(FixedBitSet, FixedBitSet)
Returns the popcount or cardinality of "a and not b" or "intersection(a, not(b))". Neither set is modified.
Declaration
public static long AndNotCount(FixedBitSet a, FixedBitSet b)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | a | |
FixedBitSet | b |
Returns
Type | Description |
---|---|
long |
Bits2words(int)
Returns the number of 64 bit words it would take to hold numBits
Declaration
public static int Bits2words(int numBits)
Parameters
Type | Name | Description |
---|---|---|
int | numBits |
Returns
Type | Description |
---|---|
int |
Clear(int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public void Clear(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Clear(int, int)
Clears a range of bits.
Declaration
public void Clear(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
int | startIndex | Lower index |
int | endIndex | One-past the last bit to clear |
Clone()
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public FixedBitSet Clone()
Returns
Type | Description |
---|---|
FixedBitSet |
EnsureCapacity(FixedBitSet, int)
If the given FixedBitSet is large enough to hold numBits
,
returns the given bits, otherwise returns a new FixedBitSet which
can hold the requested number of bits.
bits
if possible. Also, calling Length on the
returned bits may return a value greater than numBits
.
Declaration
public static FixedBitSet EnsureCapacity(FixedBitSet bits, int numBits)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | bits | |
int | numBits |
Returns
Type | Description |
---|---|
FixedBitSet |
Equals(object)
Returns true
if both sets have the same bits set
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o |
Returns
Type | Description |
---|---|
bool |
Overrides
Flip(int, int)
Flips a range of bits
Declaration
public void Flip(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
int | startIndex | Lower index |
int | endIndex | One-past the last bit to flip |
Get(int)
Returns the value of the bit with the specified index
.
Declaration
public bool Get(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index, should be non-negative and < Length. The result of passing negative or out of bounds values is undefined by this interface, just don't do it! |
Returns
Type | Description |
---|---|
bool |
|
GetAndClear(int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public bool GetAndClear(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
bool |
GetAndSet(int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public bool GetAndSet(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
bool |
GetBits()
Expert.
Declaration
public long[] GetBits()
Returns
Type | Description |
---|---|
long[] |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetIterator()
Provides a DocIdSetIterator to access the set.
This implementation can return null
if there
are no docs that match.
Declaration
public override DocIdSetIterator GetIterator()
Returns
Type | Description |
---|---|
DocIdSetIterator |
Overrides
IntersectionCount(FixedBitSet, FixedBitSet)
Returns the popcount or cardinality of the intersection of the two sets. Neither set is modified.
Declaration
public static long IntersectionCount(FixedBitSet a, FixedBitSet b)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | a | |
FixedBitSet | b |
Returns
Type | Description |
---|---|
long |
Intersects(FixedBitSet)
Returns true if the sets have any elements in common
Declaration
public bool Intersects(FixedBitSet other)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | other |
Returns
Type | Description |
---|---|
bool |
NextSetBit(int)
Returns the index of the first set bit starting at the index specified. -1 is returned if there are no more set bits.
Declaration
public int NextSetBit(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
int |
Or(DocIdSetIterator)
Does in-place OR of the bits provided by the iterator.
Declaration
public void Or(DocIdSetIterator iter)
Parameters
Type | Name | Description |
---|---|---|
DocIdSetIterator | iter |
Or(FixedBitSet)
this = this OR other
Declaration
public void Or(FixedBitSet other)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | other |
PrevSetBit(int)
Returns the index of the last set bit before or on the index specified. -1 is returned if there are no more set bits.
Declaration
public int PrevSetBit(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
int |
Set(int)
BitSet of fixed length (numBits), backed by accessible (GetBits()) long[], accessed with an int index, implementing GetBits() and DocIdSet. If you need to manage more than 2.1B bits, use Int64BitSet.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public void Set(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Set(int, int)
Sets a range of bits
Declaration
public void Set(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
int | startIndex | Lower index |
int | endIndex | One-past the last bit to set |
UnionCount(FixedBitSet, FixedBitSet)
Returns the popcount or cardinality of the union of the two sets. Neither set is modified.
Declaration
public static long UnionCount(FixedBitSet a, FixedBitSet b)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | a | |
FixedBitSet | b |
Returns
Type | Description |
---|---|
long |
Xor(DocIdSetIterator)
Does in-place XOR of the bits provided by the iterator.
Declaration
public void Xor(DocIdSetIterator iter)
Parameters
Type | Name | Description |
---|---|---|
DocIdSetIterator | iter |
Xor(FixedBitSet)
this = this XOR other
Declaration
public void Xor(FixedBitSet other)
Parameters
Type | Name | Description |
---|---|---|
FixedBitSet | other |