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-accessBytesRefarray 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 intappend(BytesRef bytes)Appends a copy of the givenBytesRefto thisBytesRefList.longbytesUsed()Returns the number internally used bytes to hold the appended bytes in memoryvoidclear()Clears thisBytesRefListBytesRefget(BytesRef spare, int ord)Returns the n'th element of thisBytesRefListBytesRefIteratoriterator()sugar foriterator(Comparator)with anullcomparatorBytesRefIteratoriterator(Comparator<BytesRef> comp)Returns aBytesRefIteratorwith point in time semantics.intsize()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 givenBytesRefto 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 spareBytesRefinstanceord- 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 anullcomparator
-
iterator
public BytesRefIterator iterator(Comparator<BytesRef> comp)
Returns a
BytesRefIteratorwith point in time semantics. The iterator provides access to all so far appendedBytesRefinstances.If a non
nullComparatoris 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.
-
-