Package repast.simphony.query.space.grid
Class VNQuery<T>
- java.lang.Object
-
- repast.simphony.query.space.grid.AbstractGridQuery<T>
-
- repast.simphony.query.space.grid.VNQuery<T>
-
- All Implemented Interfaces:
Query<T>
public class VNQuery<T> extends AbstractGridQuery<T>
Queries a grid for the Von Neumann neighborhood of a specific point or object.- Author:
- Nick Collier
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<T>
query()
Gets an iterable over all the objects that make up the Von Neumann neighborhood of the source object.Iterable<T>
query(Iterable<T> iter)
Gets an iterable over all the objects that make up the Von Neumann neighborhood of the source object and are in the specified iterable.-
Methods inherited from class repast.simphony.query.space.grid.AbstractGridQuery
reset
-
-
-
-
Constructor Detail
-
VNQuery
public VNQuery(Grid<T> grid, T source, int... extent)
Creates a Von Neumann 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 Detail
-
query
public Iterable<T> query()
Gets an iterable over all the objects that make up the Von Neumann neighborhood of the source object. The source object and neighborhood extent are specified in the constructor or the reset method. The order of the returned objects is left to right, up to down, and then optionally back to front.. For example, a 2d neighborhood centered at 2,2 with an extent of 1,1 will return the objects at (1,2), (3,2), (2, 1), (2,3).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 Von Neumann 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 returned objects is left to right, up to down, and then optionally back to front. For example, a 2d neighborhood centered at 2,2 with an extent of 1,1 will return the objects at (1,2), (3,2), (2, 1), (2,3).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.
-
-