Package org.apache.lucene.util.bkd
Class BKDReader.BKDPointTree
- java.lang.Object
-
- org.apache.lucene.util.bkd.BKDReader.BKDPointTree
-
- All Implemented Interfaces:
java.lang.Cloneable,PointValues.PointTree
- Enclosing class:
- BKDReader
private static class BKDReader.BKDPointTree extends java.lang.Object implements PointValues.PointTree
-
-
Field Summary
Fields Modifier and Type Field Description private int[]commonPrefixLengthsprivate BKDConfigconfigprivate DocIdsWriterdocIdsWriterprivate IndexInputinnerNodesprivate booleanisTreeBalancedprivate intlastLeafNodePointCountprivate long[]leafBlockFPStackprivate intleafNodeOffsetprivate IndexInputleafNodesprivate intlevelprivate byte[]maxPackedValueprivate byte[]minPackedValueprivate boolean[]negativeDeltasprivate intnodeIDprivate intnodeRoot(package private) longpointCountprivate int[]readNodeDataPositionsprivate intrightMostLeafNodeprivate int[]rightNodePositionsprivate byte[]scratchDataPackedValueprivate BKDReader.BKDReaderDocIDSetIteratorscratchIteratorprivate byte[]scratchMaxIndexPackedValueprivate byte[]scratchMinIndexPackedValueprivate int[]splitDimsPosprivate byte[][]splitDimValueStackprivate byte[][]splitValuesStackprivate intversion
-
Constructor Summary
Constructors Modifier Constructor Description privateBKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, byte[] minPackedValue, byte[] maxPackedValue, boolean isTreeBalanced)privateBKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, int nodeID, int level, byte[] minPackedValue, byte[] maxPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, int[] commonPrefixLengths, boolean isTreeBalanced)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAll(PointValues.IntersectVisitor visitor, boolean grown)private intbalanceTreeNodePosition(int minNode, int maxNode, int node, int position, int level)PointValues.PointTreeclone()Clone, the current node becomes the root of the new tree.private longgetLeafBlockFP()Only valid after pushLeft or pushRight, not pop!byte[]getMaxPackedValue()Return the maximum packed value of the current node.byte[]getMinPackedValue()Return the minimum packed value of the current node.private intgetNumLeavesSlow(int node)private intgetTreeDepth(int numLeaves)private booleanisLeafNode()private booleanisLeftNode()private booleanisRootNode()booleanmoveToChild()Move to the first child node and returntrueupon success.booleanmoveToParent()Move to the parent node and returntrueupon success.booleanmoveToSibling()Move to the next sibling node and returntrueupon success.private booleannodeExists()private voidpop()private voidpopBounds(byte[] packedValue)private voidpushBoundsLeft()private voidpushBoundsRight()private voidpushLeft()private voidpushRight()private voidreadCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in)private intreadCompressedDim(IndexInput in)private intreadDocIDs(IndexInput in, long blockFP, BKDReader.BKDReaderDocIDSetIterator iterator)private voidreadMinMax(int[] commonPrefixLengths, byte[] minPackedValue, byte[] maxPackedValue, IndexInput in)private voidreadNodeData(boolean isLeft)private voidresetNodeDataPosition()longsize()Return the number of points below the current node.private longsizeFromBalancedTree(int leftMostLeafNode, int rightMostLeafNode)java.lang.StringtoString()private voidvisitCompressedDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor, int compressedDim)voidvisitDocIDs(PointValues.IntersectVisitor visitor)Visit all the docs below the current node.voidvisitDocValues(PointValues.IntersectVisitor visitor)Visit all the docs and values below the current node.private voidvisitDocValues(PointValues.IntersectVisitor visitor, long fp)private voidvisitDocValuesNoCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor)private voidvisitDocValuesWithCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor)private voidvisitLeavesOneByOne(PointValues.IntersectVisitor visitor)private voidvisitSparseRawDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor)private voidvisitUniqueRawDocValues(byte[] scratchPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor)
-
-
-
Field Detail
-
nodeID
private int nodeID
-
nodeRoot
private final int nodeRoot
-
level
private int level
-
innerNodes
private final IndexInput innerNodes
-
leafNodes
private final IndexInput leafNodes
-
leafBlockFPStack
private final long[] leafBlockFPStack
-
readNodeDataPositions
private final int[] readNodeDataPositions
-
rightNodePositions
private final int[] rightNodePositions
-
splitDimsPos
private final int[] splitDimsPos
-
negativeDeltas
private final boolean[] negativeDeltas
-
splitValuesStack
private final byte[][] splitValuesStack
-
minPackedValue
private final byte[] minPackedValue
-
maxPackedValue
private final byte[] maxPackedValue
-
splitDimValueStack
private final byte[][] splitDimValueStack
-
config
private final BKDConfig config
-
leafNodeOffset
private final int leafNodeOffset
-
version
private final int version
-
pointCount
final long pointCount
-
lastLeafNodePointCount
private final int lastLeafNodePointCount
-
rightMostLeafNode
private final int rightMostLeafNode
-
scratchDataPackedValue
private final byte[] scratchDataPackedValue
-
scratchMinIndexPackedValue
private final byte[] scratchMinIndexPackedValue
-
scratchMaxIndexPackedValue
private final byte[] scratchMaxIndexPackedValue
-
commonPrefixLengths
private final int[] commonPrefixLengths
-
scratchIterator
private final BKDReader.BKDReaderDocIDSetIterator scratchIterator
-
docIdsWriter
private final DocIdsWriter docIdsWriter
-
isTreeBalanced
private final boolean isTreeBalanced
-
-
Constructor Detail
-
BKDPointTree
private BKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, byte[] minPackedValue, byte[] maxPackedValue, boolean isTreeBalanced) throws java.io.IOException
- Throws:
java.io.IOException
-
BKDPointTree
private BKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, int nodeID, int level, byte[] minPackedValue, byte[] maxPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, int[] commonPrefixLengths, boolean isTreeBalanced)
-
-
Method Detail
-
clone
public PointValues.PointTree clone()
Description copied from interface:PointValues.PointTreeClone, the current node becomes the root of the new tree.- Specified by:
clonein interfacePointValues.PointTree- Overrides:
clonein classjava.lang.Object
-
getMinPackedValue
public byte[] getMinPackedValue()
Description copied from interface:PointValues.PointTreeReturn the minimum packed value of the current node.- Specified by:
getMinPackedValuein interfacePointValues.PointTree
-
getMaxPackedValue
public byte[] getMaxPackedValue()
Description copied from interface:PointValues.PointTreeReturn the maximum packed value of the current node.- Specified by:
getMaxPackedValuein interfacePointValues.PointTree
-
moveToChild
public boolean moveToChild() throws java.io.IOExceptionDescription copied from interface:PointValues.PointTreeMove to the first child node and returntrueupon success. Returnsfalsefor leaf nodes andtrueotherwise.- Specified by:
moveToChildin interfacePointValues.PointTree- Throws:
java.io.IOException
-
resetNodeDataPosition
private void resetNodeDataPosition() throws java.io.IOException- Throws:
java.io.IOException
-
pushBoundsLeft
private void pushBoundsLeft()
-
pushLeft
private void pushLeft() throws java.io.IOException- Throws:
java.io.IOException
-
pushBoundsRight
private void pushBoundsRight()
-
pushRight
private void pushRight() throws java.io.IOException- Throws:
java.io.IOException
-
moveToSibling
public boolean moveToSibling() throws java.io.IOExceptionDescription copied from interface:PointValues.PointTreeMove to the next sibling node and returntrueupon success. Returnsfalseif the current node has no more siblings.- Specified by:
moveToSiblingin interfacePointValues.PointTree- Throws:
java.io.IOException
-
pop
private void pop()
-
popBounds
private void popBounds(byte[] packedValue)
-
moveToParent
public boolean moveToParent()
Description copied from interface:PointValues.PointTreeMove to the parent node and returntrueupon success. Returnsfalsefor the root node andtrueotherwise.- Specified by:
moveToParentin interfacePointValues.PointTree
-
isRootNode
private boolean isRootNode()
-
isLeftNode
private boolean isLeftNode()
-
isLeafNode
private boolean isLeafNode()
-
nodeExists
private boolean nodeExists()
-
getLeafBlockFP
private long getLeafBlockFP()
Only valid after pushLeft or pushRight, not pop!
-
size
public long size()
Description copied from interface:PointValues.PointTreeReturn the number of points below the current node.- Specified by:
sizein interfacePointValues.PointTree
-
sizeFromBalancedTree
private long sizeFromBalancedTree(int leftMostLeafNode, int rightMostLeafNode)
-
balanceTreeNodePosition
private int balanceTreeNodePosition(int minNode, int maxNode, int node, int position, int level)
-
visitDocIDs
public void visitDocIDs(PointValues.IntersectVisitor visitor) throws java.io.IOException
Description copied from interface:PointValues.PointTreeVisit all the docs below the current node.- Specified by:
visitDocIDsin interfacePointValues.PointTree- Throws:
java.io.IOException
-
addAll
public void addAll(PointValues.IntersectVisitor visitor, boolean grown) throws java.io.IOException
- Throws:
java.io.IOException
-
visitDocValues
public void visitDocValues(PointValues.IntersectVisitor visitor) throws java.io.IOException
Description copied from interface:PointValues.PointTreeVisit all the docs and values below the current node.- Specified by:
visitDocValuesin interfacePointValues.PointTree- Throws:
java.io.IOException
-
visitLeavesOneByOne
private void visitLeavesOneByOne(PointValues.IntersectVisitor visitor) throws java.io.IOException
- Throws:
java.io.IOException
-
visitDocValues
private void visitDocValues(PointValues.IntersectVisitor visitor, long fp) throws java.io.IOException
- Throws:
java.io.IOException
-
readDocIDs
private int readDocIDs(IndexInput in, long blockFP, BKDReader.BKDReaderDocIDSetIterator iterator) throws java.io.IOException
- Throws:
java.io.IOException
-
getNumLeavesSlow
private int getNumLeavesSlow(int node)
-
readNodeData
private void readNodeData(boolean isLeft) throws java.io.IOException- Throws:
java.io.IOException
-
getTreeDepth
private int getTreeDepth(int numLeaves)
-
visitDocValuesNoCardinality
private void visitDocValuesNoCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws java.io.IOException- Throws:
java.io.IOException
-
visitDocValuesWithCardinality
private void visitDocValuesWithCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws java.io.IOException- Throws:
java.io.IOException
-
readMinMax
private void readMinMax(int[] commonPrefixLengths, byte[] minPackedValue, byte[] maxPackedValue, IndexInput in) throws java.io.IOException- Throws:
java.io.IOException
-
visitSparseRawDocValues
private void visitSparseRawDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws java.io.IOException- Throws:
java.io.IOException
-
visitUniqueRawDocValues
private void visitUniqueRawDocValues(byte[] scratchPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws java.io.IOException- Throws:
java.io.IOException
-
visitCompressedDocValues
private void visitCompressedDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor, int compressedDim) throws java.io.IOException- Throws:
java.io.IOException
-
readCompressedDim
private int readCompressedDim(IndexInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
readCommonPrefixes
private void readCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in) throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-