Class MooreQuery<T>

java.lang.Object
repast.simphony.query.space.grid.AbstractGridQuery<T>
repast.simphony.query.space.grid.MooreQuery<T>
All Implemented Interfaces:
Query<T>

public class MooreQuery<T> extends AbstractGridQuery<T>
Queries a grid for the Moore neighborhood of a specific point or object. This works with 1, 2, and 3 dimensions.
Version:
$Revision$ $Date$
Author:
Nick Collier
  • Constructor Details

    • MooreQuery

      public MooreQuery(Grid<T> grid, T source, int... extent)
      Creates a Moore query on the specified grid using the specified object as the source where the neighborhood is specified by the extent. The extent defines the dimensions of the neighborhood in the x, y, and optionaly z dimensions. If the extent args are missing, they default to one.

      This object can be reused by resetting the source and extents using the reset method. The queries will return an empty iterable if the source object does not have a grid location.

      Parameters:
      grid -
      source -
      extent -
  • Method Details

    • query

      public Iterable<T> query()
      Gets an iterable over all the objects that make up the Moore neighborhood of the source object. The source object and neighborhood extent are specified in the constructor or the reset method. The order of the objects returned is back to front by column starting with the left side column.

      This will return an empty iterable if the source object does not have a grid location.

      Returns:
      an iterable over all the objects that make up the Moore neighborhood of the source object.
    • query

      public Iterable<T> query(Iterable<T> iter)
      Gets an iterable over all the objects that make up the Moore neighborhood of the source object and are in the specified iterable. The source object and neighborhood extent are specified in the constructor or the reset method. The order of the objects returned is back to front by column starting with the left side column.

      This will return an empty iterable if the source object does not have a grid location.

      Returns:
      an iterable over all the objects that make up the Moore neighborhood of the source object and are in the spefied iterable.