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.
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public sealed class BytesRefArray
Constructors
BytesRefArray(Counter)
Creates a new BytesRefArray with a counter to track allocated bytes
Declaration
public BytesRefArray(Counter bytesUsed)
Parameters
Type | Name | Description |
---|---|---|
Counter | bytesUsed |
Properties
Length
Returns the current size of this BytesRefArray.
NOTE: This was size() in Lucene.Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int | The current size of this BytesRefArray |
Methods
Append(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 |
---|---|
int | The index of the appended bytes |
Clear()
Clears this BytesRefArray
Declaration
public void Clear()
Get(BytesRef, int)
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 |
int | 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 |
---|---|---|
IComparer<BytesRef> | comparer |
Returns
Type | Description |
---|---|
IBytesRefEnumerator |