Class Gridder


  • public class Gridder
    extends java.lang.Object
    Maps positions on a 2-d grid to a 1-d index.
    Since:
    15 Feb 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      Gridder​(int nx, int ny)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getHeight()
      Returns grid height.
      int getIndex​(int ix, int iy)
      Returns the 1-d index corresponding to a given x,y position.
      int getLength()
      Returns the number of points in the grid and array.
      int getWidth()
      Returns grid width.
      int getX​(int index)
      Returns the X index corresponding to a pixel index.
      int getY​(int index)
      Returns the Y index corresponding to a pixel index.
      int hashCode()  
      static Gridder transpose​(Gridder base)
      Returns a Gridder instance that is the transpose of the supplied one.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Gridder

        public Gridder​(int nx,
                       int ny)
        Constructor.
        Parameters:
        nx - grid width
        ny - grid height
    • Method Detail

      • getWidth

        public int getWidth()
        Returns grid width.
        Returns:
        width
      • getHeight

        public int getHeight()
        Returns grid height.
        Returns:
        height
      • getIndex

        public int getIndex​(int ix,
                            int iy)
        Returns the 1-d index corresponding to a given x,y position.
        Parameters:
        ix - x position
        iy - y position
        Returns:
        array index
      • getX

        public int getX​(int index)
        Returns the X index corresponding to a pixel index.
        Parameters:
        index - 1-d index
        Returns:
        X position
      • getY

        public int getY​(int index)
        Returns the Y index corresponding to a pixel index.
        Parameters:
        index - 1-d index
        Returns:
        Y position
      • getLength

        public int getLength()
        Returns the number of points in the grid and array.
        Returns:
        size
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • transpose

        public static Gridder transpose​(Gridder base)
        Returns a Gridder instance that is the transpose of the supplied one. If the supplied instance does row-major indexing, the result does column-major instead.
        Parameters:
        base - input gridder
        Returns:
        gridder with X and Y transposed