Package org.apache.lucene.util
Class FixedLengthBytesRefArray
java.lang.Object
org.apache.lucene.util.FixedLengthBytesRefArray
- All Implemented Interfaces:
SortableBytesRefArray
Just like
BytesRefArray except all values have the same length.
Note: This class is not Thread-Safe!-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[][]private intHow many blocks are usedprivate intprivate intHow many values have been appendedprivate final intprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionFixedLengthBytesRefArray(int valueLength) Creates a newBytesRefArraywith a counter to track allocated bytes -
Method Summary
Modifier and TypeMethodDescriptionintAppends a copy of the givenBytesRefto thisBytesRefArray.voidclear()Clears thisBytesRefArrayiterator(Comparator<BytesRef> comp) Returns aBytesRefIteratorwith point in time semantics.intsize()Returns the current size of thisFixedLengthBytesRefArrayprivate int[]sort(Comparator<BytesRef> comp)
-
Field Details
-
valueLength
private final int valueLength -
valuesPerBlock
private final int valuesPerBlock -
size
private int sizeHow many values have been appended -
currentBlock
private int currentBlockHow many blocks are used -
nextEntry
private int nextEntry -
blocks
private byte[][] blocks
-
-
Constructor Details
-
FixedLengthBytesRefArray
public FixedLengthBytesRefArray(int valueLength) Creates a newBytesRefArraywith a counter to track allocated bytes
-
-
Method Details
-
clear
public void clear()Clears thisBytesRefArray- Specified by:
clearin interfaceSortableBytesRefArray
-
append
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
-
iterator
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
-