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 int
How many blocks are usedprivate int
private int
How many values have been appendedprivate final int
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionFixedLengthBytesRefArray
(int valueLength) Creates a newBytesRefArray
with a counter to track allocated bytes -
Method Summary
Modifier and TypeMethodDescriptionint
Appends a copy of the givenBytesRef
to thisBytesRefArray
.void
clear()
Clears thisBytesRefArray
iterator
(Comparator<BytesRef> comp) Returns aBytesRefIterator
with point in time semantics.int
size()
Returns the current size of thisFixedLengthBytesRefArray
private 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 newBytesRefArray
with a counter to track allocated bytes
-
-
Method Details
-
clear
public void clear()Clears thisBytesRefArray
- Specified by:
clear
in interfaceSortableBytesRefArray
-
append
Appends a copy of the givenBytesRef
to thisBytesRefArray
.- Specified by:
append
in 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:
size
in interfaceSortableBytesRefArray
- Returns:
- the current size of this
FixedLengthBytesRefArray
-
sort
-
iterator
Returns aBytesRefIterator
with point in time semantics. The iterator provides access to all so far appendedBytesRef
instances.The iterator will iterate the byte values in the order specified by the comparator.
This is a non-destructive operation.
- Specified by:
iterator
in interfaceSortableBytesRefArray
-