Interface QuadTreeReadableIType<A>

  • Type Parameters:
    A - The precise type of quadtree members
    All Superinterfaces:
    QuadTreeReadableType
    All Known Subinterfaces:
    QuadTreeIType<A>
    All Known Implementing Classes:
    QuadTreeI

    public interface QuadTreeReadableIType<A>
    extends QuadTreeReadableType
    The type of readable quadtrees with int coordinates.
    Since:
    3.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.io7m.jregions.core.unparameterized.areas.AreaI areaFor​(A item)  
      com.io7m.jregions.core.unparameterized.areas.AreaI bounds()  
      void containedBy​(com.io7m.jregions.core.unparameterized.areas.AreaI area, java.util.Set<A> items)
      Returns all objects in the tree that are completely contained within area, saving the results to items.
      boolean contains​(A item)
      Determine whether or not the object has already been inserted into the tree.
      <C> void iterateQuadrants​(C context, QuadTreeQuadrantIterationIType<A,​C> f)
      Iterate over all quadrants within the tree.
      <B> QuadTreeReadableIType<B> map​(java.util.function.BiFunction<A,​com.io7m.jregions.core.unparameterized.areas.AreaI,​B> f)
      Apply f to each element of the tree.
      void overlappedBy​(com.io7m.jregions.core.unparameterized.areas.AreaI area, java.util.Set<A> items)
      Returns all objects in the tree that are overlapped area, saving the results to items.
      void raycast​(Ray2D ray, java.util.SortedSet<QuadTreeRaycastResultI<A>> items)
      Returns all objects that are intersected by the given ray.
    • Method Detail

      • bounds

        com.io7m.jregions.core.unparameterized.areas.AreaI bounds()
        Returns:
        The tree bounds
      • contains

        boolean contains​(A item)
        Determine whether or not the object has already been inserted into the tree.
        Parameters:
        item - The object
        Returns:
        true iff the object is in the tree
      • map

        <B> QuadTreeReadableIType<B> map​(java.util.function.BiFunction<A,​com.io7m.jregions.core.unparameterized.areas.AreaI,​B> f)
        Apply f to each element of the tree.
        Type Parameters:
        B - The type of result elements
        Parameters:
        f - A mapping function
        Returns:
        A new tree
      • iterateQuadrants

        <C> void iterateQuadrants​(C context,
                                  QuadTreeQuadrantIterationIType<A,​C> f)
        Iterate over all quadrants within the tree.
        Type Parameters:
        C - The type of context values
        Parameters:
        context - A contextual value passed to f
        f - An iteration function
      • areaFor

        com.io7m.jregions.core.unparameterized.areas.AreaI areaFor​(A item)
                                                            throws java.util.NoSuchElementException
        Parameters:
        item - The item
        Returns:
        The bounding area that was specified for item
        Throws:
        java.util.NoSuchElementException - Iff the item is not present in the tree
      • containedBy

        void containedBy​(com.io7m.jregions.core.unparameterized.areas.AreaI area,
                         java.util.Set<A> items)
        Returns all objects in the tree that are completely contained within area, saving the results to items.
        Parameters:
        area - The area to examine
        items - The returned items
      • overlappedBy

        void overlappedBy​(com.io7m.jregions.core.unparameterized.areas.AreaI area,
                          java.util.Set<A> items)
        Returns all objects in the tree that are overlapped area, saving the results to items.
        Parameters:
        area - The area to examine
        items - The returned items
      • raycast

        void raycast​(Ray2D ray,
                     java.util.SortedSet<QuadTreeRaycastResultI<A>> items)
        Returns all objects that are intersected by the given ray. The objects are returned in order of distance from the origin of the ray: The first object returned will be the object nearest to the origin.
        Parameters:
        ray - The ray
        items - The intersected items