Class BytesRefArray
A simple append only random-access BytesRef array that stores full copies of the appended bytes in a ByteBlockPool.
Note: this class is not Thread-Safe!
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Note
This API is experimental and might change in incompatible ways in the next release.
Inheritance
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public sealed class BytesRefArray
Constructors
| Improve this Doc View SourceBytesRefArray(Counter)
Creates a new BytesRefArray with a counter to track allocated bytes
Declaration
public BytesRefArray(Counter bytesUsed)
Parameters
Type | Name | Description |
---|---|---|
Counter | bytesUsed |
Properties
| Improve this Doc View SourceLength
Returns the current size of this BytesRefArray.
NOTE: This was size() in Lucene.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The current size of this BytesRefArray |
Methods
| Improve this Doc View SourceAppend(BytesRef)
Appends a copy of the given BytesRef to this BytesRefArray.
Declaration
public int Append(BytesRef bytes)
Parameters
Type | Name | Description |
---|---|---|
BytesRef | bytes | The bytes to append |
Returns
Type | Description |
---|---|
System.Int32 | The index of the appended bytes |
Clear()
Clears this BytesRefArray
Declaration
public void Clear()
Get(BytesRef, Int32)
Returns the n'th element of this BytesRefArray
Declaration
public BytesRef Get(BytesRef spare, int index)
Parameters
Type | Name | Description |
---|---|---|
BytesRef | spare | A spare BytesRef instance |
System.Int32 | index | The elements index to retrieve |
Returns
Type | Description |
---|---|
BytesRef | The n'th element of this BytesRefArray |
GetEnumerator()
Sugar for GetEnumerator(IComparer<BytesRef>) with a null
comparer.
Declaration
public IBytesRefEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
IBytesRefEnumerator |
GetEnumerator(IComparer<BytesRef>)
Returns a IBytesRefEnumerator with point in time semantics. The enumerator provides access to all so far appended BytesRef instances.
If a non null
IComparer{BytesRef} is provided the enumerator will
iterate the byte values in the order specified by the comparer. Otherwise
the order is the same as the values were appended.
This is a non-destructive operation.
Declaration
public IBytesRefEnumerator GetEnumerator(IComparer<BytesRef> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IComparer<BytesRef> | comparer |
Returns
Type | Description |
---|---|
IBytesRefEnumerator |