Class BytesRefHash
Bytes
Note: The maximum capacity Bytes
Inheritance
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public sealed class BytesRefHash : IDisposable
Constructors
| Improve this Doc View SourceBytesRefHash()
Creates a new Bytes
Declaration
public BytesRefHash()
BytesRefHash(ByteBlockPool)
Creates a new Bytes
Declaration
public BytesRefHash(ByteBlockPool pool)
Parameters
Type | Name | Description |
---|---|---|
Byte |
pool |
BytesRefHash(ByteBlockPool, Int32, BytesRefHash.BytesStartArray)
Creates a new Bytes
Declaration
public BytesRefHash(ByteBlockPool pool, int capacity, BytesRefHash.BytesStartArray bytesStartArray)
Parameters
Type | Name | Description |
---|---|---|
Byte |
pool | |
System. |
capacity | |
Bytes |
bytesStartArray |
Fields
| Improve this Doc View SourceDEFAULT_CAPACITY
Declaration
public const int DEFAULT_CAPACITY = null
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceCount
Returns the number of Bytes
NOTE: This was size() in Lucene.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System. |
The number of Bytes |
Methods
| Improve this Doc View SourceAdd(BytesRef)
Adds a new Bytes
Declaration
public int Add(BytesRef bytes)
Parameters
Type | Name | Description |
---|---|---|
Bytes |
bytes | The bytes to hash |
Returns
Type | Description |
---|---|
System. |
The id the given bytes are hashed if there was no mapping for the
given bytes, otherwise |
Exceptions
Type | Condition |
---|---|
Bytes |
if the given bytes are > 2 + BYTE_BLOCK_SIZE |
AddByPoolOffset(Int32)
Adds a "arbitrary" int offset instead of a Bytes
Declaration
public int AddByPoolOffset(int offset)
Parameters
Type | Name | Description |
---|---|---|
System. |
offset |
Returns
Type | Description |
---|---|
System. |
ByteStart(Int32)
Returns the bytesStart offset into the internally used
BytebytesID
Declaration
public int ByteStart(int bytesID)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytesID | The id to look up |
Returns
Type | Description |
---|---|
System. |
The bytesStart offset into the internally used
Byte |
Clear()
Declaration
public void Clear()
Clear(Boolean)
Declaration
public void Clear(bool resetPool)
Parameters
Type | Name | Description |
---|---|---|
System. |
resetPool |
Compact()
Returns the ids array in arbitrary order. Valid ids start at offset of 0 and end at a limit of Count - 1
Note: this is a destructive operation. Clear() must be called in
order to reuse this Bytes
Declaration
public int[] Compact()
Returns
Type | Description |
---|---|
System. |
Dispose()
Closes the Bytes
Declaration
public void Dispose()
Find(BytesRef)
Returns the id of the given Bytes
Declaration
public int Find(BytesRef bytes)
Parameters
Type | Name | Description |
---|---|---|
Bytes |
bytes | The bytes to look for |
Returns
Type | Description |
---|---|
System. |
The id of the given bytes, or |
Get(Int32, BytesRef)
Populates and returns a Bytes
Note: the given bytesID must be a positive integer less than the current size (Count)
Declaration
public BytesRef Get(int bytesID, BytesRef ref)
Parameters
Returns
Type | Description |
---|---|
Bytes |
The given Bytes |
Reinit()
Reinitializes the Bytes
Declaration
public void Reinit()
Sort(IComparer<BytesRef>)
Returns the values array sorted by the referenced byte values.
Note: this is a destructive operation. Clear() must be called in
order to reuse this Bytes
Declaration
public int[] Sort(IComparer<BytesRef> comp)
Parameters
Type | Name | Description |
---|---|---|
IComparer<Bytes |
comp | The IComparer<BytesRef> used for sorting |
Returns
Type | Description |
---|---|
System. |