Package org.apache.lucene.util
Class FixedLengthBytesRefArray
- java.lang.Object
-
- org.apache.lucene.util.FixedLengthBytesRefArray
-
- All Implemented Interfaces:
SortableBytesRefArray
final class FixedLengthBytesRefArray extends java.lang.Object implements SortableBytesRefArray
Just likeBytesRefArrayexcept all values have the same length. Note: This class is not Thread-Safe!
-
-
Field Summary
Fields Modifier and Type Field Description private byte[][]blocksprivate intcurrentBlockHow many blocks are usedprivate intnextEntryprivate intsizeHow many values have been appendedprivate intvalueLengthprivate intvaluesPerBlock
-
Constructor Summary
Constructors Constructor Description FixedLengthBytesRefArray(int valueLength)Creates a newBytesRefArraywith a counter to track allocated bytes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intappend(BytesRef bytes)Appends a copy of the givenBytesRefto thisBytesRefArray.voidclear()Clears thisBytesRefArrayBytesRefIteratoriterator(java.util.Comparator<BytesRef> comp)Returns aBytesRefIteratorwith point in time semantics.intsize()Returns the current size of thisFixedLengthBytesRefArrayprivate int[]sort(java.util.Comparator<BytesRef> comp)
-
-
-
Constructor Detail
-
FixedLengthBytesRefArray
public FixedLengthBytesRefArray(int valueLength)
Creates a newBytesRefArraywith a counter to track allocated bytes
-
-
Method Detail
-
clear
public void clear()
Clears thisBytesRefArray- Specified by:
clearin interfaceSortableBytesRefArray
-
append
public int append(BytesRef bytes)
Appends a copy of the givenBytesRefto thisBytesRefArray.- Specified by:
appendin interfaceSortableBytesRefArray- Parameters:
bytes- the bytes to append- Returns:
- the index of the appended bytes
-
size
public int size()
Returns the current size of thisFixedLengthBytesRefArray- Specified by:
sizein interfaceSortableBytesRefArray- Returns:
- the current size of this
FixedLengthBytesRefArray
-
sort
private int[] sort(java.util.Comparator<BytesRef> comp)
-
iterator
public BytesRefIterator iterator(java.util.Comparator<BytesRef> comp)
Returns a
BytesRefIteratorwith point in time semantics. The iterator provides access to all so far appendedBytesRefinstances.The iterator will iterate the byte values in the order specified by the comparator.
This is a non-destructive operation.
- Specified by:
iteratorin interfaceSortableBytesRefArray
-
-