Class VNContains<T>


  • public class VNContains<T>
    extends Object
    Determines whether or not a particular target object is in the Von Neumann neighborhood of a particular source. This works with 1D, 2D and 3D grids only.
    Version:
    $Revision$ $Date$
    Author:
    Nick Collier
    • Constructor Detail

      • VNContains

        public VNContains​(Grid<T> grid)
        Creates a VN contains for the specified grid.
        Parameters:
        grid -
    • Method Detail

      • isNeighbor

        public boolean isNeighbor​(T source,
                                  T target,
                                  int... extent)
        Checks if the specified target is within the Von Neumann neighborhood of the specified source. The neighborhood is defined by the extent argument which contains the extent of the neighborhood in the relevant dimensions.
        Parameters:
        source - the source object of the neighborhood
        target - the object to test if it is in the neighborhood
        extent - defines the extents of the neighborhood.
        Returns:
        true if the target is in the Von Neumann neighborhood of the source.