Class GridWithin<T>

  • All Implemented Interfaces:
    Query<T>

    public class GridWithin<T>
    extends WithinDistance<T>
    A within type query over a grid space. This query will return all the objects that are within a specified distance of a specified object in either all the grid spaces in a context or in a specific grid space. "Within" includes the distance, so within 10 means all the objects from a distance of 0 to 10 including 10.
    Version:
    $Revision$ $Date$
    Author:
    Nick Collier
    • Constructor Detail

      • GridWithin

        public GridWithin​(Context<T> context,
                          T obj,
                          double distance)
        Creates a GridWithin query that will find all the objects within the specified distance of the specified object in all the grid spaces in the specified context.
        Parameters:
        context -
        obj -
        distance -
      • GridWithin

        public GridWithin​(Grid<T> space,
                          T obj,
                          double distance)
        Creates a GridWithin query that will find all the objects within the specified distance of the specified object in the specified space.
        Parameters:
        space -
        obj -
        distance -
    • Method Detail

      • createIterable

        protected Iterable<T> createIterable()
        Creates an iterable over all the objects within the specified distance in the space.
        Specified by:
        createIterable in class WithinDistance<T>
        Returns:
        an iterable over all the objects within the specified distance in the space.
      • createIterable

        protected Iterable<T> createIterable​(Context<T> context)
        Creates an iterable over all the objects within the specified distance in all the continuoous spaces in the context.
        Specified by:
        createIterable in class WithinDistance<T>
        Parameters:
        context -
        Returns:
        an iterable over all the objects within the specified distance in all the continuoous spaces in the context.