Class Node

  • Direct Known Subclasses:
    Point

    public class Node
    extends Object
    • 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)
      • getChildren

        public List<Node> getChildren()
      • isLeaf

        public boolean isLeaf()
      • getArea

        public double getArea()
      • contains

        public boolean contains​(float[] coords)
      • enclose

        public boolean enclose()
      • addToBitmapIndex

        public void addToBitmapIndex​(Node node)
      • clear

        public void clear()
      • getSizeInBytes

        public int getSizeInBytes()
      • storeInByteBuffer

        public int storeInByteBuffer​(ByteBuffer buffer,
                                     int position)