Interface GridPointTranslator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void init​(GridDimensions dimensions)
      Initializes this with the given dimensions.
      boolean isToroidal()
      True if this grid is toroidal (in the sense that moving off one border makes you appear on the other one), otherwise false.
      void transform​(int[] transformedLocation, int... targetLocation)
      Transform the given targetLocation according to this GridPointTranslator's semantics.
      void transform​(GridPoint transformedLocation, int... targetLocation)
      Transform the given targetLocation according to this GridPointTranslator's semantics.
      void translate​(int[] location, int... displacement)
      Translate the specified location by the specified displacement.
    • Method Detail

      • init

        void init​(GridDimensions dimensions)
        Initializes this with the given dimensions.
        Parameters:
        dimensions - the dimensions of the space
      • translate

        void translate​(int[] location,
                       int... displacement)
        Translate the specified location by the specified displacement. The new location will stored in the location array. For example, if the location is (3, 4) and the displacement is (1, -2), the new location will be (4, 2).
        Parameters:
        location - the current location
        displacement - the amount to translate
      • transform

        void transform​(int[] transformedLocation,
                       int... targetLocation)
                throws SpatialException
        Transform the given targetLocation according to this GridPointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.
        Parameters:
        transformedLocation - the coordinates once they have been transformed by this GridPointTranslator
        targetLocation - the new target location whose coordinates will be transformed
        Throws:
        SpatialException - if the transform is invalid. For example, if the new location is outside of the grid.
      • transform

        void transform​(GridPoint transformedLocation,
                       int... targetLocation)
                throws SpatialException
        Transform the given targetLocation according to this GridPointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.
        Parameters:
        transformedLocation - the coordinates once they have been transformed by this GridPointTranslator
        targetLocation - the new target location whose coordinates will be transformed
        Throws:
        SpatialException - if the transform is invalid. For example, if the new location is outside of the grid.
      • isToroidal

        boolean isToroidal()
        True if this grid is toroidal (in the sense that moving off one border makes you appear on the other one), otherwise false.
        Returns:
        true if this grid is toroidal, otherwise false.