Package org.apache.lucene.search.suggest
Class BytesRefList
- java.lang.Object
-
- org.apache.lucene.search.suggest.BytesRefList
-
public final class BytesRefList extends Object
A simple append only random-accessBytesRef
array that stores full copies of the appended bytes in aByteBlockPool
. Note: This class is not Thread-Safe!- WARNING: This API is experimental and might change in incompatible ways in the next release.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description BytesRefList()
Creates a newBytesRefList
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
append(BytesRef bytes)
Appends a copy of the givenBytesRef
to thisBytesRefList
.long
bytesUsed()
Returns the number internally used bytes to hold the appended bytes in memoryvoid
clear()
Clears thisBytesRefList
BytesRef
get(BytesRef spare, int ord)
Returns the n'th element of thisBytesRefList
BytesRefIterator
iterator()
sugar foriterator(Comparator)
with anull
comparatorBytesRefIterator
iterator(Comparator<BytesRef> comp)
Returns aBytesRefIterator
with point in time semantics.int
size()
Returns the current size of thisBytesRefList
-
-
-
Constructor Detail
-
BytesRefList
public BytesRefList()
Creates a newBytesRefList
-
-
Method Detail
-
clear
public void clear()
Clears thisBytesRefList
-
append
public int append(BytesRef bytes)
Appends a copy of the givenBytesRef
to thisBytesRefList
.- Parameters:
bytes
- the bytes to append- Returns:
- the ordinal of the appended bytes
-
size
public int size()
Returns the current size of thisBytesRefList
- Returns:
- the current size of this
BytesRefList
-
get
public BytesRef get(BytesRef spare, int ord)
Returns the n'th element of thisBytesRefList
- Parameters:
spare
- a spareBytesRef
instanceord
- the elements ordinal to retrieve- Returns:
- the n'th element of this
BytesRefList
-
bytesUsed
public long bytesUsed()
Returns the number internally used bytes to hold the appended bytes in memory- Returns:
- the number internally used bytes to hold the appended bytes in memory
-
iterator
public BytesRefIterator iterator()
sugar foriterator(Comparator)
with anull
comparator
-
iterator
public BytesRefIterator iterator(Comparator<BytesRef> comp)
Returns a
BytesRefIterator
with point in time semantics. The iterator provides access to all so far appendedBytesRef
instances.If a non
null
Comparator
is provided the iterator will iterate the byte values in the order specified by the comparator. Otherwise the order is the same as the values were appended.This is a non-destructive operation.
-
-