java.lang.Object
org.apache.lucene.util.bkd.HeapPointWriter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PointWriter
Utility class to write new points into in-heap arrays.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Reusable implementation for a point value on-heap -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
private boolean
private final BKDConfig
private final int
private final ArrayUtil.ByteArrayComparator
private int
private final HeapPointWriter.HeapPointValue
private final byte[]
(package private) final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(byte[] packedValue, int docID) Add a new point from the packed value and docIdvoid
append
(PointValue pointValue) Add a new point from aPointValue
(package private) int
byteAt
(int i, int k) Return the byte at positionk
of the point at positioni
void
close()
private int
compareDataDimsAndDoc
(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) (package private) int
compareDataDimsAndDoc
(int j, byte[] dataDimsAndDocs, int offset) Compares the data dimensions and doc values of the point at positionj
with the provided value(package private) int
compareDataDimsAndDoc
(int i, int j) Compares the data dimensions and doc values of the point at positioni
with the point at positionj
private int
compareDim
(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) (package private) int
compareDim
(int j, byte[] dimValue, int offset, int dim) Compares the dimensiondim
value of the point at positionj
with the provided value(package private) int
compareDim
(int i, int j, int dim) Compares the dimensiondim
value of the point at positioni
with the point at positionj
int
computeCardinality
(int from, int to, int[] commonPrefixLengths) Computes the cardinality of the points betweenfrom
tpto
(package private) void
copyDataDimsAndDoc
(int i, byte[] bytes, int offset) Copy the data dimensions and doc value of the point at positioni
in the providedbytes
at the given offset(package private) void
copyDim
(int i, int dim, byte[] bytes, int offset) Copy the dimensiondim
of the point at positioni
in the providedbytes
at the given offsetlong
count()
Return the number of points in this writervoid
destroy()
Removes any temp files behind this writergetPackedValueSlice
(int index) Returns a reference, inresult
, to the byte[] slice holding this valuegetReader
(long start, long length) Returns aPointReader
iterator to step through all previously added points(package private) void
swap
(int i, int j) Swaps the point at pointi
with the point at positionj
toString()
-
Field Details
-
block
private final byte[] block -
size
final int size -
config
-
scratch
private final byte[] scratch -
dimComparator
-
dataDimsAndDocLength
private final int dataDimsAndDocLength -
nextWrite
private int nextWrite -
closed
private boolean closed -
pointValue
-
-
Constructor Details
-
HeapPointWriter
-
-
Method Details
-
getPackedValueSlice
Returns a reference, inresult
, to the byte[] slice holding this value -
append
public void append(byte[] packedValue, int docID) Description copied from interface:PointWriter
Add a new point from the packed value and docId- Specified by:
append
in interfacePointWriter
-
append
Description copied from interface:PointWriter
Add a new point from aPointValue
- Specified by:
append
in interfacePointWriter
-
swap
void swap(int i, int j) Swaps the point at pointi
with the point at positionj
-
byteAt
int byteAt(int i, int k) Return the byte at positionk
of the point at positioni
-
copyDim
void copyDim(int i, int dim, byte[] bytes, int offset) Copy the dimensiondim
of the point at positioni
in the providedbytes
at the given offset -
copyDataDimsAndDoc
void copyDataDimsAndDoc(int i, byte[] bytes, int offset) Copy the data dimensions and doc value of the point at positioni
in the providedbytes
at the given offset -
compareDim
int compareDim(int i, int j, int dim) Compares the dimensiondim
value of the point at positioni
with the point at positionj
-
compareDim
int compareDim(int j, byte[] dimValue, int offset, int dim) Compares the dimensiondim
value of the point at positionj
with the provided value -
compareDim
private int compareDim(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) -
compareDataDimsAndDoc
int compareDataDimsAndDoc(int i, int j) Compares the data dimensions and doc values of the point at positioni
with the point at positionj
-
compareDataDimsAndDoc
int compareDataDimsAndDoc(int j, byte[] dataDimsAndDocs, int offset) Compares the data dimensions and doc values of the point at positionj
with the provided value -
compareDataDimsAndDoc
private int compareDataDimsAndDoc(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) -
computeCardinality
public int computeCardinality(int from, int to, int[] commonPrefixLengths) Computes the cardinality of the points betweenfrom
tpto
-
count
public long count()Description copied from interface:PointWriter
Return the number of points in this writer- Specified by:
count
in interfacePointWriter
-
getReader
Description copied from interface:PointWriter
Returns aPointReader
iterator to step through all previously added points- Specified by:
getReader
in interfacePointWriter
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
destroy
public void destroy()Description copied from interface:PointWriter
Removes any temp files behind this writer- Specified by:
destroy
in interfacePointWriter
-
toString
-