Interface PointGrid

    • Method Detail

      • height

        int height()
        Returns the length of this array. This is equivalent to rows().length().
        Returns:
        the grid height.
      • get

        DirectPosition get​(int row,
                           int column,
                           DirectPosition dest)
                    throws IndexOutOfBoundsException
        Gets a copy of the DirectPosition at the particular location in this PointGrid. If the dest argument is non-null, that object will be populated with the value from the array. In all cases, the position in insulated from changes in the PointArray, and vice-versa. Consequently, the same DirectPosition object can be reused for fetching many points from this grid. Example:
          DirectPosition position = null;
          for (int j=0; j<grid.height(); j++) {
              for (int i=0; i<grid.width(); i++) {
                  position = array.get(j, i, position);
                  // Do some processing...
              }
          }
         
        Parameters:
        row - The row index from 0 inclusive to height() exclusive.
        column - The column index from 0 inclusive to width() exclusive.
        dest - An optionnaly pre-allocated direct position.
        Returns:
        the dest argument, or a new object if dest was null.
        Throws:
        IndexOutOfBoundsException - if an index is out of bounds.
      • set

        void set​(int row,
                 int column,
                 DirectPosition position)
          throws IndexOutOfBoundsException,
                 UnsupportedOperationException
        Set the point at the given index. The point coordinates will be copied, i.e. changes to the given position after this method call will not be reflected into this point array. Consequently, the same DirectPosition object can be reused for setting many points in this array.
        Parameters:
        row - The row index from 0 inclusive to height() exclusive.
        column - The column index from 0 inclusive to width() exclusive.
        position - The point to set at the given location in this array.
        Throws:
        IndexOutOfBoundsException - if an index is out of bounds.
        UnsupportedOperationException - if this grid is immutable.
      • getRow

        PointArray getRow​(int row)
                   throws IndexOutOfBoundsException
        Returns the row at the given index. The row is backed by this PointGrid, so changes to the row are reflected in the grid, and vice-versa.
        Parameters:
        row - The index from 0 inclusive to height() exclusive.
        Returns:
        the row at the given index.
        Throws:
        IndexOutOfBoundsException - if the index is out of bounds.