Class QuadTree.SubTree<T extends Envelope>

    • Constructor Detail

      • SubTree

        SubTree​(QuadTree<T> root,
                Rectangle boundingBox)
        Construct a new sub tree.
        Parameters:
        root - QuadTree<T>; the root
        boundingBox - Rectangle; the bounding box of the new sub tree
    • Method Detail

      • getBoundingBox

        public final Rectangle getBoundingBox()
        Retrieve the bounding box of this sub tree.
        Returns:
        Rectangle; the bounding box of this sub tree
      • size

        public int size()
        Return the number of objects stored in and under this SubTree.
        Returns:
        int; the number of objects stored in and under this SubTree
      • add

        public boolean add​(RectangleAndPayload<T> e)
        Add a RectangleAndPayload to this SubTree.
        Parameters:
        e - RectangleAndPayload<T>; the object to add
        Returns:
        boolean; true if this SubTree was changed (object was added); false if this SubTree did not change
      • remove

        public boolean remove​(RectangleAndPayload<T> o)
        Remove a RectangleAndPayload from this SubTree.
        Parameters:
        o - RectangleAndPayload<T>; the object to remove
        Returns:
        boolean; true if this SubTree was changed (object was removed); false if this SubTree did not change
      • clear

        public void clear()
        Delete all objects stored in this SubTree.
      • contains

        public boolean contains​(RectangleAndPayload<T> o)
        Determine if this SubTree contains a specific object.
        Parameters:
        o - RectangleAndPayload<T>; the object to search
        Returns:
        boolean; true if this SubTree contains the object
      • recursiveContains

        boolean recursiveContains​(RectangleAndPayload<T> o)
        Recursively search for a particular object.
        Parameters:
        o - RectangleAndPayload<T>; the object to search for
        Returns:
        boolean; true if this quad tree contains the object; false if this quad tree does not contain the object
      • recursiveCollect

        public Set<RectangleAndPayload<T>> recursiveCollect​(Rectangle rectangle)
        Recursively collect all elements that intersect the given rectangle.
        Parameters:
        rectangle - Rectangle; the rectangle
        Returns:
        Set<RectangleAndPayload<T>>; all stored elements that intersect the given rectangle
      • toString

        public String toString​(int expandDepth)
        Return a textual representation of this quad tree up to the specified depth.
        Parameters:
        expandDepth - int; the maximum depth to expand
        Returns:
        String; textual representation of this quad tree
      • dump

        public String dump​(String indent)
        Dump a quad tree.
        Parameters:
        indent - String; prefix for each output line
        Returns:
        String; textual description of this quad tree.