Class Node
- java.lang.Object
-
- org.apache.druid.collections.spatial.Node
-
-
Constructor Summary
Constructors Constructor Description Node(float[] minCoordinates, float[] maxCoordinates, boolean isLeaf, BitmapFactory bitmapFactory)
Node(float[] minCoordinates, float[] maxCoordinates, Node child, boolean isLeaf, Node parent, MutableBitmap bitmap)
This constructor accepts a single nullable child Node (null value means no child) instead of a collection of children Nodes, because Nodes with no more than one child are created in the codebase yet, while passing a collection of Nodes would necessitate making a defensive copy of this collection in the constructor and extra overhead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(Node node)
void
addToBitmapIndex(Node node)
void
clear()
boolean
contains(float[] coords)
boolean
enclose()
double
getArea()
MutableBitmap
getBitmap()
List<Node>
getChildren()
float[]
getMaxCoordinates()
float[]
getMinCoordinates()
int
getNumDims()
Node
getParent()
int
getSizeInBytes()
boolean
isLeaf()
int
storeInByteBuffer(ByteBuffer buffer, int position)
-
-
-
Constructor Detail
-
Node
public Node(float[] minCoordinates, float[] maxCoordinates, boolean isLeaf, BitmapFactory bitmapFactory)
-
Node
public Node(float[] minCoordinates, float[] maxCoordinates, @Nullable Node child, boolean isLeaf, Node parent, MutableBitmap bitmap)
This constructor accepts a single nullable child Node (null value means no child) instead of a collection of children Nodes, because Nodes with no more than one child are created in the codebase yet, while passing a collection of Nodes would necessitate making a defensive copy of this collection in the constructor and extra overhead. (One could note that the principle of making a defensive copy is happily violated just in this constructor, other parameters: minCoordinates, maxCoordinates and bitmap. These are recognized flaws that are not tackled yet.) If cases when a Node should be created with multiple children arise, this constructor should be changed to accept a collection of children Nodes.
-
-
Method Detail
-
getNumDims
public int getNumDims()
-
getMinCoordinates
public float[] getMinCoordinates()
-
getMaxCoordinates
public float[] getMaxCoordinates()
-
getParent
public Node getParent()
-
addChild
public void addChild(Node node)
-
isLeaf
public boolean isLeaf()
-
getArea
public double getArea()
-
contains
public boolean contains(float[] coords)
-
enclose
public boolean enclose()
-
getBitmap
public MutableBitmap getBitmap()
-
addToBitmapIndex
public void addToBitmapIndex(Node node)
-
clear
public void clear()
-
getSizeInBytes
public int getSizeInBytes()
-
storeInByteBuffer
public int storeInByteBuffer(ByteBuffer buffer, int position)
-
-