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 classReusable implementation for a point value on-heap -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private booleanprivate final BKDConfigprivate final intprivate final ArrayUtil.ByteArrayComparatorprivate intprivate final HeapPointWriter.HeapPointValueprivate final byte[](package private) final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(byte[] packedValue, int docID) Add a new point from the packed value and docIdvoidappend(PointValue pointValue) Add a new point from aPointValue(package private) intbyteAt(int i, int k) Return the byte at positionkof the point at positionivoidclose()private intcompareDataDimsAndDoc(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) (package private) intcompareDataDimsAndDoc(int j, byte[] dataDimsAndDocs, int offset) Compares the data dimensions and doc values of the point at positionjwith the provided value(package private) intcompareDataDimsAndDoc(int i, int j) Compares the data dimensions and doc values of the point at positioniwith the point at positionjprivate intcompareDim(byte[] blockI, int offsetI, byte[] blockJ, int offsetJ) (package private) intcompareDim(int j, byte[] dimValue, int offset, int dim) Compares the dimensiondimvalue of the point at positionjwith the provided value(package private) intcompareDim(int i, int j, int dim) Compares the dimensiondimvalue of the point at positioniwith the point at positionjintcomputeCardinality(int from, int to, int[] commonPrefixLengths) Computes the cardinality of the points betweenfromtpto(package private) voidcopyDataDimsAndDoc(int i, byte[] bytes, int offset) Copy the data dimensions and doc value of the point at positioniin the providedbytesat the given offset(package private) voidcopyDim(int i, int dim, byte[] bytes, int offset) Copy the dimensiondimof the point at positioniin the providedbytesat the given offsetlongcount()Return the number of points in this writervoiddestroy()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 aPointReaderiterator to step through all previously added points(package private) voidswap(int i, int j) Swaps the point at pointiwith the point at positionjtoString()
-
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:PointWriterAdd a new point from the packed value and docId- Specified by:
appendin interfacePointWriter
-
append
Description copied from interface:PointWriterAdd a new point from aPointValue- Specified by:
appendin interfacePointWriter
-
swap
void swap(int i, int j) Swaps the point at pointiwith the point at positionj -
byteAt
int byteAt(int i, int k) Return the byte at positionkof the point at positioni -
copyDim
void copyDim(int i, int dim, byte[] bytes, int offset) Copy the dimensiondimof the point at positioniin the providedbytesat the given offset -
copyDataDimsAndDoc
void copyDataDimsAndDoc(int i, byte[] bytes, int offset) Copy the data dimensions and doc value of the point at positioniin the providedbytesat the given offset -
compareDim
int compareDim(int i, int j, int dim) Compares the dimensiondimvalue of the point at positioniwith the point at positionj -
compareDim
int compareDim(int j, byte[] dimValue, int offset, int dim) Compares the dimensiondimvalue of the point at positionjwith 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 positioniwith the point at positionj -
compareDataDimsAndDoc
int compareDataDimsAndDoc(int j, byte[] dataDimsAndDocs, int offset) Compares the data dimensions and doc values of the point at positionjwith 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 betweenfromtpto -
count
public long count()Description copied from interface:PointWriterReturn the number of points in this writer- Specified by:
countin interfacePointWriter
-
getReader
Description copied from interface:PointWriterReturns aPointReaderiterator to step through all previously added points- Specified by:
getReaderin interfacePointWriter
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
destroy
public void destroy()Description copied from interface:PointWriterRemoves any temp files behind this writer- Specified by:
destroyin interfacePointWriter
-
toString
-