Package org.apache.lucene.util.bkd
Class HeapPointWriter
- java.lang.Object
-
- org.apache.lucene.util.bkd.HeapPointWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,PointWriter
public final class HeapPointWriter extends java.lang.Object implements PointWriter
Utility class to write new points into in-heap arrays.
-
-
Field Summary
Fields Modifier and Type Field Description byte[]blockprivate booleanclosed(package private) BKDConfigconfigprivate intnextWriteprivate HeapPointReader.HeapPointValuepointValueprivate byte[]scratch(package private) intsize
-
Constructor Summary
Constructors Constructor Description HeapPointWriter(BKDConfig config, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(byte[] packedValue, int docID)Add a new point from the packed value and docIdvoidappend(PointValue pointValue)Add a new point from aPointValuevoidclose()intcomputeCardinality(int from, int to, int[] commonPrefixLengths)longcount()Return the number of points in this writervoiddestroy()Removes any temp files behind this writerPointValuegetPackedValueSlice(int index)Returns a reference, inresult, to the byte[] slice holding this valuePointReadergetReader(long start, long length)Returns aPointReaderiterator to step through all previously added pointsvoidswap(int i, int j)java.lang.StringtoString()
-
-
-
Field Detail
-
block
public final byte[] block
-
size
final int size
-
config
final BKDConfig config
-
scratch
private final byte[] scratch
-
nextWrite
private int nextWrite
-
closed
private boolean closed
-
pointValue
private HeapPointReader.HeapPointValue pointValue
-
-
Constructor Detail
-
HeapPointWriter
public HeapPointWriter(BKDConfig config, int size)
-
-
Method Detail
-
getPackedValueSlice
public PointValue getPackedValueSlice(int index)
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
public void append(PointValue pointValue)
Description copied from interface:PointWriterAdd a new point from aPointValue- Specified by:
appendin interfacePointWriter
-
swap
public void swap(int i, int j)
-
computeCardinality
public int computeCardinality(int from, int to, int[] commonPrefixLengths)
-
count
public long count()
Description copied from interface:PointWriterReturn the number of points in this writer- Specified by:
countin interfacePointWriter
-
getReader
public PointReader getReader(long start, long length)
Description copied from interface:PointWriterReturns aPointReaderiterator to step through all previously added points- Specified by:
getReaderin interfacePointWriter
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
destroy
public void destroy()
Description copied from interface:PointWriterRemoves any temp files behind this writer- Specified by:
destroyin interfacePointWriter
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-