## Class BlockTree

- java.lang.Object
- - BlockTree

-     public class BlockTree
      extends java.lang.Object

  An instance is a non-empty collection of points organized in a hierarchical binary tree structure.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockTree(java.util.ArrayList<Block> blocks)` Constructor: a binary tree containing blocks.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(Vector2D p)` Return true iff this collection of blocks contains point p.
    `BoundingBox` | `getBox()` Return the bounding box of the collection of blocks.
    `int` | `getNumBlocks()` Return the number of blocks contained in this tree.
    `boolean` | `isIntermediate()` Return true iff this is an intermediate node.
    `boolean` | `isLeaf()` Return true iff this is a leaf node.
    `boolean` | `overlaps(Vector2D thisD, BlockTree t, Vector2D d)` Return true iff (this tree displaced by thisD) and (tree t displaced by d) overlap.
    `java.lang.String` | `toString()` Return a representation of this instance.
    `java.lang.String` | `toString(Vector2D d)` Return a representation of this tree displaced by d.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BlockTree

          public BlockTree(java.util.ArrayList<Block> blocks)

      Constructor: a binary tree containing blocks. Precondition: blocks is nonempty, i.e. it contain at least one block.

  - ### Method Detail

    - #### getBox

          public BoundingBox getBox()

      Return the bounding box of the collection of blocks.

    - #### isLeaf

          public boolean isLeaf()

      Return true iff this is a leaf node.

    - #### isIntermediate

          public boolean isIntermediate()

      Return true iff this is an intermediate node.

    - #### getNumBlocks

          public int getNumBlocks()

      Return the number of blocks contained in this tree.

    - #### contains

          public boolean contains(Vector2D p)

      Return true iff this collection of blocks contains point p.

    - #### overlaps

          public boolean overlaps(Vector2D thisD,
                         BlockTree t,
                         Vector2D d)

      Return true iff (this tree displaced by thisD) and (tree t displaced by d) overlap.

    - #### toString

          public java.lang.String toString()

      Return a representation of this instance.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString(Vector2D d)

      Return a representation of this tree displaced by d.