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 likeBytesRefArray
except all values have the same length. Note: This class is not Thread-Safe!
-
-
Field Summary
Fields Modifier and Type Field Description private byte[][]
blocks
private int
currentBlock
How many blocks are usedprivate int
nextEntry
private int
size
How many values have been appendedprivate int
valueLength
private int
valuesPerBlock
-
Constructor Summary
Constructors Constructor Description FixedLengthBytesRefArray(int valueLength)
Creates a newBytesRefArray
with a counter to track allocated bytes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
append(BytesRef bytes)
Appends a copy of the givenBytesRef
to thisBytesRefArray
.void
clear()
Clears thisBytesRefArray
BytesRefIterator
iterator(java.util.Comparator<BytesRef> comp)
Returns aBytesRefIterator
with point in time semantics.int
size()
Returns the current size of thisFixedLengthBytesRefArray
private int[]
sort(java.util.Comparator<BytesRef> comp)
-
-
-
Constructor Detail
-
FixedLengthBytesRefArray
public FixedLengthBytesRefArray(int valueLength)
Creates a newBytesRefArray
with a counter to track allocated bytes
-
-
Method Detail
-
clear
public void clear()
Clears thisBytesRefArray
- Specified by:
clear
in interfaceSortableBytesRefArray
-
append
public int append(BytesRef bytes)
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
private int[] sort(java.util.Comparator<BytesRef> comp)
-
iterator
public BytesRefIterator iterator(java.util.Comparator<BytesRef> comp)
Returns a
BytesRefIterator
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
-
-