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(org.apache.lucene.util.BytesRef bytes)Appends a copy of the givenBytesRefto thisBytesRefList.longbytesUsed()Returns the number internally used bytes to hold the appended bytes in memoryvoidclear()Clears thisBytesRefListorg.apache.lucene.util.BytesRefget(org.apache.lucene.util.BytesRef spare, int ord)Returns the n'th element of thisBytesRefListorg.apache.lucene.util.BytesRefIteratoriterator()sugar foriterator(Comparator)with anullcomparatororg.apache.lucene.util.BytesRefIteratoriterator(Comparator<org.apache.lucene.util.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(org.apache.lucene.util.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 org.apache.lucene.util.BytesRef get(org.apache.lucene.util.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 org.apache.lucene.util.BytesRefIterator iterator()
sugar foriterator(Comparator)with anullcomparator
-
iterator
public org.apache.lucene.util.BytesRefIterator iterator(Comparator<org.apache.lucene.util.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.
-
-