uk.ac.leeds.ccg.andyt.grids.core
Class Grid2DSquareCellAbstract

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.OutOfMemoryErrorHandler
      extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellAbstract
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Grid2DSquareCellDouble, Grid2DSquareCellInt

public abstract class Grid2DSquareCellAbstract
extends OutOfMemoryErrorHandler
implements java.io.Serializable

Contains CellID and ChunkID classes, referencing and general geometry methods. It also controls what methods extended classes must implement acting like an interface. The basic geometries are ordered in set numbers of rows and columns and are arranged sequentially as their base two-dimensional orthogonal coordinate axes. The sequential arrangement goes along the x-axis row by row from the y-axis, then up the y-axis taking each row in turn. TODO: Handling for NumberFormatExceptions and ArithmeticExceptions in calculations

See Also:
Serialized Form

Nested Class Summary
static class Grid2DSquareCellAbstract.CellID
          A simple CellID class for distinguishing cells.
static class Grid2DSquareCellAbstract.ChunkID
          A simple ChunkID class for distinguishing chunks.
 
Field Summary
protected  int chunkNcols
          For storing the (usual) number of columns of cells in a chunk.
protected  int chunkNrows
          For storing the (usual) number of rows of cells in a chunk.
protected  java.math.BigDecimal[] dimensions
          For storing cellsize, minx, miny, maxx, maxy.
protected  int dimensionsScale
          For storing the minimum number of decimal places used to store dimensions.
protected  java.io.File directory
          Local directory used for caching.
protected  java.util.HashMap grid2DSquareCellChunks
          The Grid2DSquareCellChunkAbstract data cache.
protected  java.util.HashSet grid2DSquareCells
          A HashMap of swappable objects that may be juggled to release memory for processing
protected  GridStatisticsAbstract gridStatistics
          A reference to the grid Statistics Object.
protected  java.lang.String name
          For storing the name of the grid.
protected  int nChunkCols
          For storing the number of chunk columns.
protected  int nChunkRows
          For storing the number of chunk rows.
protected  long ncols
          For storing the number of columns in the grid.
protected  long nrows
          For storing the number of rows in the grid.
protected static UnsignedLongPowersOf2 unsignedLongPowersOf2
          For storing individual locations mapped to a binary encoded long.
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.core.OutOfMemoryErrorHandler
handleOutOfMemoryErrorFalse, handleOutOfMemoryErrorTrue, memoryReserve
 
Constructor Summary
Grid2DSquareCellAbstract()
           
 
Method Summary
protected  void clearFromCacheGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
          For releasing a grid2DSquareCellChunk stored in memory.
protected  void clearFromCacheGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          For releasing a grid2DSquareCellChunk stored in memory.
protected  void clearFromCacheGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          For releasing a grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.
protected  void clearFromCacheGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          For releasing a grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.
protected  void clearFromCacheGrid2DSquareCellChunks()
          For releasing all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
protected  void clearFromCacheGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
          For releasing all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
protected  void clearFromCacheGrid2DSquareCellChunks(java.util.HashSet chunkIDs)
          Clears Grid2DSquareCellChunkAbstracts with ChunkIDs in chunkIDs.
protected  void clearFromCacheGrid2DSquareCellChunks(java.util.HashSet chunkIDs, boolean handleOutOfMemoryError)
          Clears Grid2DSquareCellChunkAbstracts with ChunkIDs in chunkIDs.
protected  void clearFromCacheGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          For releasing all grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.
protected  void clearFromCacheGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          For releasing all grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.
protected  void clearFromCacheGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs)
          For releasing all grid2DSquareCellChunk stored in memory except those with ChunkIDs in chunkIDs.
protected  void clearFromCacheGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs, boolean handleOutOfMemoryError)
          For releasing all grid2DSquareCellChunk stored in memory except those with ChunkIDs in chunkIDs.
protected  java.lang.String getBasicDescription()
          Returns a basic description of this instance.
 java.lang.String getBasicDescription(boolean handleOutOfMemoryError)
          Returns a basic description of this instance.
protected  double[] getCellBoundsDoubleArray(double x, double y)
          Returns double[] where; double[0] xmin, left most x-coordinate of cell that intersects point at (x,y) double[1] ymin, lowest y-coordinate of cell that intersects point at (x,y) double[2] xmax, right most x-coordinate of cell that intersects point at (x,y) double[3] ymax, highest y-coordinate of cell that intersects point at (x,y)
 double[] getCellBoundsDoubleArray(double x, double y, boolean handleOutOfMemoryError)
          Returns double[] where; double[0] xmin, left most x-coordinate of cell that intersects point at (x,y) double[1] ymin, lowest y-coordinate of cell that intersects point at (x,y) double[2] xmax, right most x-coordinate of cell that intersects point at (x,y) double[3] ymax, highest y-coordinate of cell that intersects point at (x,y)
protected  double[] getCellBoundsDoubleArray(long cellRowIndex, long cellColIndex)
          Returns double[] where; double[0] xmin, left most x-coordinate of cell at (rowIndex,colIndex) double[1] ymin, lowest y-coordinate of cell at (rowIndex,colIndex) double[2] xmax, right most x-coordinate of cell at (rowIndex,colIndex) double[3] ymax, highest y-coordinate of cell at (rowIndex,colIndex)
 double[] getCellBoundsDoubleArray(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns double[] where; double[0] xmin, left most x-coordinate of cell at (rowIndex,colIndex) double[1] ymin, lowest y-coordinate of cell at (rowIndex,colIndex) double[2] xmax, right most x-coordinate of cell at (rowIndex,colIndex) double[3] ymax, highest y-coordinate of cell at (rowIndex,colIndex)
protected  long getCellColIndex(java.math.BigDecimal xBigDecimal)
          Returns the cell column Index for the cell column that intersect the x-coordinate xBigDecimal.
 long getCellColIndex(java.math.BigDecimal xBigDecimal, boolean handleOutOfMemoryError)
          Returns the cell column Index for the cell column that intersect the x-coordinate xBigDecimal.
protected  long getCellColIndex(double x)
          Returns the cell column Index for the cell column that intersect the x-coordinate x.
 long getCellColIndex(double x, boolean handleOutOfMemoryError)
          Returns the cell column Index for the cell column that intersect the x-coordinate x.
protected  double getCellDouble(double x, double y)
          Returns Grid2DSquareCellChunkAbstract cell value at at point given by x-coordinate x and y-coordinate y as a double.
 double getCellDouble(double x, double y, boolean handleOutOfMemoryError)
          Returns Grid2DSquareCellChunkAbstract cell value at at point given by x-coordinate x and y-coordinate y as a double.
protected  double getCellDouble(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk, int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a double.
 double getCellDouble(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk, int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a double.
protected  double getCellDouble(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.
 double getCellDouble(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.
protected  double getCellDouble(long cellRowIndex, long cellColIndex)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.
 double getCellDouble(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.
protected  double getCellDouble(java.awt.geom.Point2D.Double point)
          Returns Grid2DSquareCellChunkAbstract cell value at at Point2D.Double point as a double.
 double getCellDouble(java.awt.geom.Point2D.Double point, boolean handleOutOfMemoryError)
          Returns Grid2DSquareCellChunkAbstract cell value at at Point2D.Double point as a double.
protected  Grid2DSquareCellAbstract.CellID getCellID(double x, double y)
          Returns a CellID of the cell given by x-coordinate x, y-coordinate y even if that cell would not be in the grid.
 Grid2DSquareCellAbstract.CellID getCellID(double x, double y, boolean handleOutOfMemoryError)
          Returns a CellID of the cell given by x-coordinate x, y-coordinate y even if that cell would not be in the grid.
protected  Grid2DSquareCellAbstract.CellID getCellID(long cellRowIndex, long cellColIndex)
          Returns a new CellID of the cell given by cell row index cellRowIndex, cell column index cellColIndex.
 Grid2DSquareCellAbstract.CellID getCellID(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns a new CellID of the cell given by cell row index cellRowIndex, cell column index cellColIndex.
protected  Grid2DSquareCellAbstract.CellID[] getCellIDs(double x, double y, double distance)
          Returns a CellID[] - the cell IDs for cells thats centroids are intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.
 Grid2DSquareCellAbstract.CellID[] getCellIDs(double x, double y, double distance, boolean handleOutOfMemoryError)
          Returns a CellID[] - the cell IDs for cells thats centroids are intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.
protected  Grid2DSquareCellAbstract.CellID[] getCellIDs(double x, double y, long cellRowIndex, long cellColIndex, double distance)
          Returns double[] cells - the values for cells thats centroids would be intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.
 Grid2DSquareCellAbstract.CellID[] getCellIDs(double x, double y, long cellRowIndex, long cellColIndex, double distance, boolean handleOutOfMemoryError)
          Returns double[] cells - the values for cells thats centroids would be intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.
protected  Grid2DSquareCellAbstract.CellID[] getCellIDs(long cellRowIndex, long cellColIndex, double distance)
          Returns a CellID[] - the cell IDs for cells thats centroids would be intersected by circle with centre at centroid of cell given by cell row index cellRowIndex, cell column index cellColIndex, and radius distance.
 Grid2DSquareCellAbstract.CellID[] getCellIDs(long cellRowIndex, long cellColIndex, double distance, boolean handleOutOfMemoryError)
          Returns a CellID[] - the cell IDs for cells thats centroids would be intersected by circle with centre at centroid of cell given by cell row index cellRowIndex, cell column index cellColIndex, and radius distance.
protected  int getCellInt(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk, int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.
 int getCellInt(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk, int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.
protected  int getCellInt(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.
 int getCellInt(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.
protected  int getCellInt(long cellRowIndex, long cellColIndex)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a int.
 int getCellInt(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a int.
protected  long getCellRowIndex(java.math.BigDecimal yBigDecimal)
          Returns the cell row Index for the cells that intersect the line with y-coordinate yBigDecimal.
 long getCellRowIndex(java.math.BigDecimal yBigDecimal, boolean handleOutOfMemoryError)
          Returns the cell row Index for the cells that intersect the line with y-coordinate yBigDecimal.
protected  long getCellRowIndex(double y)
          Returns the cell row Index for the cells that intersect the line with y-coordinate y.
 long getCellRowIndex(double y, boolean handleOutOfMemoryError)
          Returns the cell row Index for the cells that intersect the line with y-coordinate y.
 double getCellsizeDouble(boolean handleOutOfMemoryError)
          Returns a double equal to this.dimensions[0].doubleValue.
protected  java.math.BigDecimal getCellXBigDecimal(Grid2DSquareCellAbstract.CellID cellID)
          Returns the x-coordinate of the centroid for cell with cell ID cellID as a BigDecimal.
 java.math.BigDecimal getCellXBigDecimal(Grid2DSquareCellAbstract.CellID cellID, boolean handleOutOfMemoryError)
          Returns the x-coordinate of the centroid for cell with cell ID cellID as a BigDecimal.
protected  java.math.BigDecimal getCellXBigDecimal(long cellColIndex)
          Returns the x-coordinate of the centroid for cells with column index cellColIndex as a BigDecimal.
 java.math.BigDecimal getCellXBigDecimal(long cellColIndex, boolean handleOutOfMemoryError)
          Returns the x-coordinate of the centroid for cells with column index cellColIndex as a BigDecimal.
protected  double getCellXDouble(Grid2DSquareCellAbstract.CellID cellID)
          Returns the x-coordinate of the centroid for cell with cell ID cellID as a double
 double getCellXDouble(Grid2DSquareCellAbstract.CellID cellID, boolean handleOutOfMemoryError)
          Returns the x-coordinate of the centroid for cell with cell ID cellID as a double
protected  double getCellXDouble(long cellColIndex)
          Returns the x-coordinate of the centroid for cells with column index cellColIndex as a double.
 double getCellXDouble(long cellColIndex, boolean handleOutOfMemoryError)
          Returns the x-coordinate of the centroid for cells with column index cellColIndex as a double.
protected  java.math.BigDecimal getCellYBigDecimal(Grid2DSquareCellAbstract.CellID cellID)
          Returns the y-coordinate of the centroid of cell with CellID cellID as a BigDecimal.
 java.math.BigDecimal getCellYBigDecimal(Grid2DSquareCellAbstract.CellID cellID, boolean handleOutOfMemoryError)
          Returns the y-coordinate of the centroid of cell with CellID cellID as a BigDecimal.
protected  java.math.BigDecimal getCellYBigDecimal(long cellRowIndex)
          Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a BigDecimal.
 java.math.BigDecimal getCellYBigDecimal(long cellRowIndex, boolean handleOutOfMemoryError)
          Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a BigDecimal.
protected  double getCellYDouble(Grid2DSquareCellAbstract.CellID cellID)
          Returns the y-coordinate of the centroid of cell with CellID cellID as a double.
 double getCellYDouble(Grid2DSquareCellAbstract.CellID cellID, boolean handleOutOfMemoryError)
          Returns the y-coordinate of the centroid of cell with CellID cellID as a double.
protected  double getCellYDouble(long cellRowIndex)
          Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a double.
 double getCellYDouble(long cellRowIndex, boolean handleOutOfMemoryError)
          Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a double.
protected  int getChunkCellColIndex(double x)
          Returns the chunk cell column Index of the cells that intersect the x-coordinate x.
 int getChunkCellColIndex(double x, boolean handleOutOfMemoryError)
          Returns the chunk cell column Index of the cells that intersect the x-coordinate x.
protected  int getChunkCellColIndex(long cellColIndex)
          Returns the chunk cell column index of the cells in the cell column index cellColIndex.
 int getChunkCellColIndex(long cellColIndex, boolean handleOutOfMemoryError)
          Returns the chunk cell column index of the cells in the cell column index cellColIndex.
protected  int getChunkCellRowIndex(double y)
          Returns the chunk cell row Index of the cells that intersects the line with y-coordinate y.
 int getChunkCellRowIndex(double y, boolean handleOutOfMemoryError)
          Returns the chunk cell row Index of the cells that intersects the line with y-coordinate y.
protected  int getChunkCellRowIndex(long cellRowIndex)
          Returns the chunk cell row index of the cells with cell row index equal to cellRowIndex.
 int getChunkCellRowIndex(long cellRowIndex, boolean handleOutOfMemoryError)
          Returns the chunk cell row index of the cells with cell row index equal to cellRowIndex.
protected  int getChunkColIndex(double x)
          Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the x-coordinate x.
 int getChunkColIndex(double x, boolean handleOutOfMemoryError)
          Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the x-coordinate x.
protected  int getChunkColIndex(long cellColIndex)
          Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the cell column index cellColIndex.
 int getChunkColIndex(long cellColIndex, boolean handleOutOfMemoryError)
          Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the cell column index cellColIndex.
 int getChunkNcols(boolean handleOutOfMemoryError)
          Returns this.chunkNcols.
protected  int getChunkNcols(Grid2DSquareCellAbstract.ChunkID chunkID)
          Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID
 int getChunkNcols(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID
protected  int getChunkNcols(int chunkColIndex)
          Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID.chunkColIndex equal to chunkColIndex.
 int getChunkNcols(int chunkColIndex, boolean handleOutOfMemoryError)
          Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID.chunkColIndex equal to chunkColIndex.
protected  int getChunkNcolsFinalColChunks()
          Returns the number of cols in the final col Chunk
protected  int getChunkNcolsFinalColChunks(boolean handleOutOfMemoryError)
          Returns the number of cols in the final col Chunk
 int getChunkNrows(boolean handleOutOfMemoryError)
          Returns this.chunkNrows.
protected  int getChunkNrows(Grid2DSquareCellAbstract.ChunkID chunkID)
          Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID
 int getChunkNrows(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID
protected  int getChunkNrows(int chunkRowIndex)
          Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex.
 int getChunkNrows(int chunkRowIndex, boolean handleOutOfMemoryError)
          Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex.
protected  int getChunkNrowsFinalRowChunks()
          Returns the number of rows in the final row Chunk.
protected  int getChunkNrowsFinalRowChunks(boolean handleOutOfMemoryError)
          Returns the number of rows in the final row Chunk.
protected  int getChunkRowIndex(double y)
          Returns the chunk row index for the chunks intersecting the line given by y-coordinate y.
 int getChunkRowIndex(double y, boolean handleOutOfMemoryError)
          Returns the chunk row index for the chunks intersecting the line given by y-coordinate y.
protected  int getChunkRowIndex(long cellRowIndex)
          Returns the chunk row index for the chunk intersecting the cells with cell row index cellRowIndex.
 int getChunkRowIndex(long cellRowIndex, boolean handleOutOfMemoryError)
          Returns the chunk row index for the chunk intersecting the cells with cell row index cellRowIndex.
 java.math.BigDecimal[] getDimensions(boolean handleOutOfMemoryError)
          Returns a copy of this.dimensions.
protected  int getDimensionsScale(boolean handleOutOfMemoryError)
          Returns a copy of this.dimensionsScale.
protected  java.io.File getDirectory()
          Returns a copy of directory.
 java.io.File getDirectory(boolean handleOutOfMemoryError)
          Returns a copy of directory.
protected  Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
          Returns the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.
protected  Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Returns the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.
protected  Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(int chunkRowIndex, int chunkColIndex)
          Returns the Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex and ChunkID.chunkColIndex equal to chunkColIndex.
protected  Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          Returns the Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex and ChunkID.chunkColIndex equal to chunkColIndex.
protected  java.util.HashSet getGrid2DSquareCells()
           
protected  double[] getGridBounds()
          Returns gridBounds (the bounding box of the grid) as a double[] where; gridBounds[0] xmin, left most x-coordinate of this gridBounds[1] ymin, lowest y-coordinate of this gridBounds[2] xmax, right most x-coordinate of this gridBounds[3] ymax, highest y-coordinate of this TODO: Are bounds in double range? Is there more than cellsize difference with precision? Throw appropriate exceptions.
 double[] getGridBounds(boolean handleOutOfMemoryError)
          Returns gridBounds (the bounding box of the grid) as a double[] where; gridBounds[0] xmin, left most x-coordinate of this gridBounds[1] ymin, lowest y-coordinate of this gridBounds[2] xmax, right most x-coordinate of this gridBounds[3] ymax, highest y-coordinate of this
 GridStatisticsAbstract getGridStatistics()
          Returns this.gridStatistics TODO: For safety, this method should either be removed and this class be made implement GridStatisticsInterface.
protected  java.math.BigDecimal getHeightBigDecimal()
          Returns the height of the grid.
 java.math.BigDecimal getHeightBigDecimal(boolean handleOutOfMemoryError)
          Returns the height of the grid.
protected  double getHeightDouble()
          Returns the height of the grid.
 double getHeightDouble(boolean handleOutOfMemoryError)
          Returns the height of the grid.
protected  java.lang.String getName()
          Returns a copy of this.name.
 java.lang.String getName(boolean handleOutOfMemoryError)
          Returns a copy of this.name.
 int getNChunkCols(boolean handleOutOfMemoryError)
          Returns a copy of this.nChunkCols.
 int getNChunkRows(boolean handleOutOfMemoryError)
          Returns a copy of this.nChunkRows.
protected  long getNChunks()
           
 long getNChunks(boolean handleOutOfMemoryError)
           
 long getNcols(boolean handleOutOfMemoryError)
          Returns a copy of this.ncols.
protected  Grid2DSquareCellAbstract.CellID getNearestCellID(double x, double y)
          Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by x-coordinate x, y-coordinate y.
 Grid2DSquareCellAbstract.CellID getNearestCellID(double x, double y, boolean handleOutOfMemoryError)
          Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by x-coordinate x, y-coordinate y.
protected  Grid2DSquareCellAbstract.CellID getNearestCellID(double x, double y, long cellRowIndex, long cellColIndex)
          Returns the the nearest CellID to point given by x-coordinate x, y-coordinate y in position given by cellRowIndex, cellColIndex.
 Grid2DSquareCellAbstract.CellID getNearestCellID(double x, double y, long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns the the nearest CellID to point given by x-coordinate x, y-coordinate y in position given by cellRowIndex, cellColIndex.
protected  Grid2DSquareCellAbstract.CellID getNearestCellID(long cellRowIndex, long cellColIndex)
          Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by cell row index cellRowIndex, cell column index cellColIndex.
 Grid2DSquareCellAbstract.CellID getNearestCellID(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by cell row index cellRowIndex, cell column index cellColIndex.
protected  Grid2DSquareCellAbstract.ChunkID getNextChunk(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols)
          Returns the next ChunkID in row major order from chunkID, or null.
 Grid2DSquareCellAbstract.ChunkID getNextChunk(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols, boolean handleOutOfMemoryError)
          Returns the next ChunkID in row major order from chunkID, or null.
protected  Grid2DSquareCellAbstract.ChunkID getNextChunkRowMinor(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols)
          Returns the next ChunkID in row minor order from this, or null.
 Grid2DSquareCellAbstract.ChunkID getNextChunkRowMinor(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols, boolean handleOutOfMemoryError)
          Returns the next ChunkID in row minor order from this, or null.
abstract  java.math.BigDecimal getNoDataValueBigDecimal(boolean handleOutOfMemoryError)
          Returns the noDataValue of this as a BigDecimal.
 long getNrows(boolean handleOutOfMemoryError)
          Returns a copy of this.nrows.
protected  Grid2DSquareCellAbstract.ChunkID getPreviousChunk(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols)
          Returns the next ChunkID in row major order from this, or null.
 Grid2DSquareCellAbstract.ChunkID getPreviousChunk(Grid2DSquareCellAbstract.ChunkID chunkID, int nChunkRows, int nChunkCols, boolean handleOutOfMemoryError)
          Returns the next ChunkID in row major order from this, or null.
protected  java.math.BigDecimal getWidthBigDecimal()
          Returns the width of the grid as a BigDecimal.
 java.math.BigDecimal getWidthBigDecimal(boolean handleOutOfMemoryError)
          Returns the width of the grid as a BigDecimal.
protected  double getWidthDouble()
          Returns the width of the grid as a double.
 double getWidthDouble(boolean handleOutOfMemoryError)
          Returns the width of the grid as a double.
protected  void initDimensions(java.math.BigDecimal[] dimensions)
          Initialises this.dimensions and this.dimensionScale.
protected  void initGrid2DSquareCellAbstract()
          Initialises Grid2DSquareCellAbstract fields of this.
protected  void initGrid2DSquareCellAbstract(Grid2DSquareCellAbstract grid2DSquareCell)
          Initialises non transient Grid2DSquareCellAbstract fields from grid2DSquareCell
protected  void initGrid2DSquareCellChunks(java.io.File gridFile)
           
 void initMemoryReserve(boolean handleOutOfMemoryError)
          Initialises memoryReserve.
protected  void initNChunkCols()
          Initialises this.nChunkCols.
protected  void initNChunkRows()
          Initialises this.nChunkRows.
protected  boolean isInCache(Grid2DSquareCellAbstract.ChunkID chunkID)
          Returns true iff grid2DSquareCellChunk given by chunkID is swapToFiled.
 boolean isInCache(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Returns true iff grid2DSquareCellChunk given by chunkID is in memory.
protected  boolean isInGrid(java.math.BigDecimal xBigDecimal, java.math.BigDecimal yBigDecimal)
          Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid.
 boolean isInGrid(java.math.BigDecimal xBigDecimal, java.math.BigDecimal yBigDecimal, boolean handleOutOfMemoryError)
          Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid.
protected  boolean isInGrid(double x, double y)
          Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid.
 boolean isInGrid(double x, double y, boolean handleOutOfMemoryError)
          Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid.
protected  boolean isInGrid(Grid2DSquareCellAbstract.CellID cellID)
          Returns true iff cell given by cellID is in the Grid.
 boolean isInGrid(Grid2DSquareCellAbstract.CellID cellID, boolean handleOutOfMemoryError)
          Returns true iff cell given by cellID is in the Grid.
protected  boolean isInGrid(Grid2DSquareCellAbstract.ChunkID chunkID)
          Returns true iff ChunkID chunkID is in the Grid.
 boolean isInGrid(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Returns true iff ChunkID chunkID is in the Grid.
protected  boolean isInGrid(int chunkRowIndex, int chunkColIndex)
          Returns true iff position given by chunk row index chunkRowIndex, chunk column index chunkColIndex is in the Grid.
 boolean isInGrid(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          Returns true iff position given by chunk row index chunkRowIndex, chunk column index chunkColIndex is in the Grid.
protected  boolean isInGrid(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex)
          Returns true iff cell given by chunkRowIndex, chunkColIndex, chunkCellRowIndex, chunkCellColIndex is in the Grid.
 boolean isInGrid(int chunkRowIndex, int chunkColIndex, int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns true iff cell given by chunkRowIndex, chunkColIndex, chunkCellRowIndex, chunkCellColIndex is in the Grid.
protected  boolean isInGrid(long cellRowIndex, long cellColIndex)
          Returns true iff position given by cell row index cellRowIndex, cell column index cellColIndex is in the Grid.
 boolean isInGrid(long cellRowIndex, long cellColIndex, boolean handleOutOfMemoryError)
          Returns true iff position given by cell row index cellRowIndex, cell column index cellColIndex is in the Grid.
abstract  java.util.Iterator iterator(boolean handleOutOfMemoryError)
          Returns an iterator over the cell values in this.
protected  void loadIntoCacheChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
          Attempts to load into the memory cache Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.
 void loadIntoCacheChunk(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Attempts to load into the memory cache a AbstractGrid2DSquareCellChunk with ChunkID
protected  void loadIntoCacheChunk(int chunkRowIndex, int chunkColIndex)
          Restores a grid2DSquareCellChunk from a swapped cache file.
 void loadIntoCacheChunk(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          Restores a grid2DSquareCellChunk from a swapped cache file.
abstract  double setCell(long cellRowIndex, long cellColIndex, double valueToSet, boolean handleOutOfMemoryError)
          Returns the value at cellRowIndex, cellColIndex as a double and sets it to valueToSet.
 void setChunk(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk, Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Sets the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID to grid2DSquareCellChunk.
 void setGrid2DSquareCells(java.util.HashSet grid2DSquareCells, boolean handleOutOfMemoryError)
          Sets this.grid2DSquareCells to grid2DSquareCells
protected  void setName(java.lang.String name)
          Sets this.name to name.
 void setName(java.lang.String name, boolean handleOutOfMemoryError)
          Sets this.name to name.
protected  Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunk()
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
 Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
 Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(java.util.HashSet chunkIDs)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
 Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(java.util.HashSet chunkIDs, boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  long swapToFileGrid2DSquareCellChunks()
          Attempts to swap seriailsed version of all grid2DSquareCellChunks.
 long swapToFileGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
          Attempts to swap seriailsed version of all grid2DSquareCellChunks.
protected  long swapToFileGrid2DSquareCellChunks(int cri0, int cci0, int cri1, int cci1)
          Attempts to swap seriailsed version of all Grid2DSquareCellChunk from (cri0, cci0) to (cri1, cci1) in row major order.
 long swapToFileGrid2DSquareCellChunks(int cri0, int cci0, int cri1, int cci1, boolean handleOutOfMemoryError)
          Attempts to swap seriailsed version of all Grid2DSquareCellChunk from (cri0, cci0) to (cri1, cci1) in row major order.
protected  long swapToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this except that with ChunkID chunkID.
 long swapToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  long swapToFileGrid2DSquareCellsGrid2DSquareCellChunk()
          Attempts to swap to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
 long swapToFileGrid2DSquareCellsGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
          Attempts to swap to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  long swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          Attempts to write to file and clear from the cache (swap) a Grid2DSquareCellChunkAbstract in each Grid2DSquareCellAbstract of this.grid2DSquareCells.
 long swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache (swap) a Grid2DSquareCellChunkAbstract in each Grid2DSquareCellAbstract of this.grid2DSquareCells.
protected  long swapToFileGrid2DSquareCellsGrid2DSquareCellChunks()
          Attempts to write to file and clear from the cache all Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
 long swapToFileGrid2DSquareCellsGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
          Attempts to write to file and clear from the cache all Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.
protected  long swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          Attempts to swap to file and clear from the cache the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells that do not have a ChunkID equal to chunkID.
 long swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          Attempts to swap to file and clear from the cache the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells that do not have a ChunkID equal to chunkID.
abstract  java.lang.String toString(boolean handleOutOfMemoryError)
          Returns a string description of the instance.
protected  java.lang.String toString(int flag)
          Returns a string description of the Abstract fields of this instance.
 java.lang.String toString(int flag, boolean handleOutOfMemoryError)
          Returns a string description of the Abstract fields of this instance.
protected  void writeToFile(boolean swapToFileCache)
          A method to write this instance to Files located in the directory returned by getDirectory().
 void writeToFile(boolean swapToFileCache, boolean handleOutOfMemoryError)
          A method to write this instance to Files located in the directory returned by getDirectory().
protected  Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunk()
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
 Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
protected  boolean writeToFileGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
          A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by chunkID.
 boolean writeToFileGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by chunkID.
protected  boolean writeToFileGrid2DSquareCellChunk(int chunkRowIndex, int chunkColIndex)
          A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by; chunk row index chunkRowIndex, chunk column index chunkColIndex.
 boolean writeToFileGrid2DSquareCellChunk(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by; chunk row index chunkRowIndex, chunk column index chunkColIndex.
protected  Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.
 Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.
protected  Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(int chunkRowIndex, int chunkColIndex)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
 Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
protected  Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(Grid2DSquareCellAbstract.ChunkID chunkID)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
 Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
protected  Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(int chunkRowIndex, int chunkColIndex)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
 Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(int chunkRowIndex, int chunkColIndex, boolean handleOutOfMemoryError)
          A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex.
protected  void writeToFileGrid2DSquareCellChunks()
          A method that attempts to write to File seriailized versions of all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
 void writeToFileGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
          A method that attempts to write to File seriailized versions of all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.
protected  void writeToFileGrid2DSquareCellChunks(java.util.HashSet chunkIDs)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks that have ChunkID equal to those in chunkIDs.
 void writeToFileGrid2DSquareCellChunks(java.util.HashSet chunkIDs, boolean handleOutOfMemoryError)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks that have ChunkID equal to those in chunkIDs.
protected  void writeToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.
 void writeToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID, boolean handleOutOfMemoryError)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.
protected  void writeToFileGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except those that have ChunkID in chunkIDs.
 void writeToFileGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs, boolean handleOutOfMemoryError)
          A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except those that have ChunkID in chunkIDs.
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.OutOfMemoryErrorHandler
clearMemoryReserve, initMemoryReserve, initMemoryReserve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grid2DSquareCells

protected transient java.util.HashSet grid2DSquareCells
A HashMap of swappable objects that may be juggled to release memory for processing


directory

protected transient java.io.File directory
Local directory used for caching. TODO This should not be transient so as it is possible to ascertain where the data has come from.


grid2DSquareCellChunks

protected transient java.util.HashMap grid2DSquareCellChunks
The Grid2DSquareCellChunkAbstract data cache. A collection is used rather than an array because an element of a collection set to null is available for garbage collection whereas an element of an array set to null seems not to be.


gridStatistics

protected GridStatisticsAbstract gridStatistics
A reference to the grid Statistics Object.


nChunkRows

protected int nChunkRows
For storing the number of chunk rows.


nChunkCols

protected int nChunkCols
For storing the number of chunk columns.


chunkNrows

protected int chunkNrows
For storing the (usual) number of rows of cells in a chunk. The number of rows in the final chunk row may be less.


chunkNcols

protected int chunkNcols
For storing the (usual) number of columns of cells in a chunk. The number of columns in the final chunk column may be less.


nrows

protected long nrows
For storing the number of rows in the grid.


ncols

protected long ncols
For storing the number of columns in the grid.


name

protected java.lang.String name
For storing the name of the grid.


dimensions

protected java.math.BigDecimal[] dimensions
For storing cellsize, minx, miny, maxx, maxy. Although maxx and maxy could be easily calculated if required, for convenience they are calculated and stored by default during construction.


dimensionsScale

protected int dimensionsScale
For storing the minimum number of decimal places used to store dimensions.


unsignedLongPowersOf2

protected static UnsignedLongPowersOf2 unsignedLongPowersOf2
For storing individual locations mapped to a binary encoded long. This is only used in Grid2DSquareCellDoubleChunk64CellMap and Grid2DSquareCellIntChunk64CellMap. It is stored in this to save it being stored in every chunk or calculated on the fly.

Constructor Detail

Grid2DSquareCellAbstract

public Grid2DSquareCellAbstract()
Method Detail

initMemoryReserve

public final void initMemoryReserve(boolean handleOutOfMemoryError)
Initialises memoryReserve.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

initGrid2DSquareCellChunks

protected void initGrid2DSquareCellChunks(java.io.File gridFile)

initGrid2DSquareCellAbstract

protected void initGrid2DSquareCellAbstract()
Initialises Grid2DSquareCellAbstract fields of this.


initGrid2DSquareCellAbstract

protected void initGrid2DSquareCellAbstract(Grid2DSquareCellAbstract grid2DSquareCell)
Initialises non transient Grid2DSquareCellAbstract fields from grid2DSquareCell

Parameters:
grid2DSquareCell - The Grid2DSquareCellAbstract from which the non transient Grid2DSquareCellAbstract fields of this are set.

getGrid2DSquareCells

protected java.util.HashSet getGrid2DSquareCells()
Returns:
a reference to this.grid2DSquareCells

setGrid2DSquareCells

public void setGrid2DSquareCells(java.util.HashSet grid2DSquareCells,
                                 boolean handleOutOfMemoryError)
Sets this.grid2DSquareCells to grid2DSquareCells

Parameters:
grid2DSquareCells - The HashSet this.grid2DSquareCells is set to.

getGridStatistics

public GridStatisticsAbstract getGridStatistics()
Returns this.gridStatistics TODO: For safety, this method should either be removed and this class be made implement GridStatisticsInterface. This done the methods introduced would be made to call the relevant ones in this.gridStatistics. Or the gridStatistics need to be made safe in that only copies of fields are passed.


getGrid2DSquareCellChunk

protected Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(int chunkRowIndex,
                                                                 int chunkColIndex,
                                                                 boolean handleOutOfMemoryError)
Returns the Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex and ChunkID.chunkColIndex equal to chunkColIndex.

Parameters:
chunkRowIndex - The ChunkID.chunkRowIndex of the returned Grid2DSquareCellChunkAbstract.
chunkColIndex - The ChunkID.chunkColIndex of the returned Grid2DSquareCellChunkAbstract.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getGrid2DSquareCellChunk

protected Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(int chunkRowIndex,
                                                                 int chunkColIndex)
Returns the Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex and ChunkID.chunkColIndex equal to chunkColIndex.

Parameters:
chunkRowIndex - The ChunkID.chunkRowIndex of the returned Grid2DSquareCellChunkAbstract.
chunkColIndex - The ChunkID.chunkColIndex of the returned Grid2DSquareCellChunkAbstract.

getGrid2DSquareCellChunk

protected Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                 boolean handleOutOfMemoryError)
Returns the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the returned Grid2DSquareCellChunkAbstract.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getGrid2DSquareCellChunk

protected Grid2DSquareCellChunkAbstract getGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
Returns the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the returned Grid2DSquareCellChunkAbstract.

iterator

public abstract java.util.Iterator iterator(boolean handleOutOfMemoryError)
Returns an iterator over the cell values in this.


toString

public abstract java.lang.String toString(boolean handleOutOfMemoryError)
Returns a string description of the instance.


toString

public java.lang.String toString(int flag,
                                 boolean handleOutOfMemoryError)
Returns a string description of the Abstract fields of this instance.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
flag - This is ignored. It is simply to distinguish this method from the abstract method toString(boolean).

toString

protected java.lang.String toString(int flag)
Returns a string description of the Abstract fields of this instance.

Parameters:
flag - This is ignored. It is simply to distinguish this method from the abstract method toString(boolean).

getDirectory

public java.io.File getDirectory(boolean handleOutOfMemoryError)
Returns a copy of directory.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getDirectory

protected java.io.File getDirectory()
Returns a copy of directory.


getName

public java.lang.String getName(boolean handleOutOfMemoryError)
Returns a copy of this.name.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getName

protected java.lang.String getName()
Returns a copy of this.name.


setName

public void setName(java.lang.String name,
                    boolean handleOutOfMemoryError)
Sets this.name to name.

Parameters:
name - The String this.name is set to.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

setName

protected void setName(java.lang.String name)
Sets this.name to name.

Parameters:
name - The String this.name is set to.

getBasicDescription

public java.lang.String getBasicDescription(boolean handleOutOfMemoryError)
Returns a basic description of this instance.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getBasicDescription

protected java.lang.String getBasicDescription()
Returns a basic description of this instance.


setChunk

public void setChunk(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk,
                     Grid2DSquareCellAbstract.ChunkID chunkID,
                     boolean handleOutOfMemoryError)
Sets the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID to grid2DSquareCellChunk.

Parameters:
grid2DSquareCellChunk - The Grid2DSquareCellChunkAbstract that the Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID is set as.
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract that is set.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNcols

public final long getNcols(boolean handleOutOfMemoryError)
Returns a copy of this.ncols.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNrows

public final long getNrows(boolean handleOutOfMemoryError)
Returns a copy of this.nrows.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNChunkRows

public final int getNChunkRows(boolean handleOutOfMemoryError)
Returns a copy of this.nChunkRows.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

initNChunkRows

protected final void initNChunkRows()
Initialises this.nChunkRows.


getNChunkCols

public final int getNChunkCols(boolean handleOutOfMemoryError)
Returns a copy of this.nChunkCols.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNChunks

public final long getNChunks(boolean handleOutOfMemoryError)
Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellDoubleChunkAbstracts in this as a long.

getNChunks

protected final long getNChunks()
Returns:
the number of Grid2DSquareCellDoubleChunkAbstracts in this as a long.

initNChunkCols

protected final void initNChunkCols()
Initialises this.nChunkCols.


getChunkNrows

public final int getChunkNrows(boolean handleOutOfMemoryError)
Returns this.chunkNrows.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNrows

public final int getChunkNrows(int chunkRowIndex,
                               boolean handleOutOfMemoryError)
Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex.

Parameters:
chunkRowIndex - The ChunkID.chunkRowIndex of the Grid2DSquareCellChunkAbstract thats chunkNrows is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNrows

protected final int getChunkNrows(int chunkRowIndex)
Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID.chunkRowIndex equal to chunkRowIndex.

Parameters:
chunkRowIndex - The ChunkID.chunkRowIndex of the Grid2DSquareCellChunkAbstract thats chunkNrows is returned.

getChunkNcols

public final int getChunkNcols(boolean handleOutOfMemoryError)
Returns this.chunkNcols.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNcols

public final int getChunkNcols(int chunkColIndex,
                               boolean handleOutOfMemoryError)
Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID.chunkColIndex equal to chunkColIndex.

Parameters:
chunkColIndex - The ChunkID.chunkColIndex of the Grid2DSquareCellChunkAbstract thats chunkNrows is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNcols

protected final int getChunkNcols(int chunkColIndex)
Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID.chunkColIndex equal to chunkColIndex.

Parameters:
chunkColIndex - The ChunkID.chunkColIndex of the Grid2DSquareCellChunkAbstract thats chunkNrows is returned.

getChunkNrowsFinalRowChunks

protected final int getChunkNrowsFinalRowChunks(boolean handleOutOfMemoryError)
Returns the number of rows in the final row Chunk.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNrowsFinalRowChunks

protected final int getChunkNrowsFinalRowChunks()
Returns the number of rows in the final row Chunk.


getChunkNcolsFinalColChunks

protected final int getChunkNcolsFinalColChunks(boolean handleOutOfMemoryError)
Returns the number of cols in the final col Chunk

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNcolsFinalColChunks

protected final int getChunkNcolsFinalColChunks()
Returns the number of cols in the final col Chunk


getChunkNrows

public final int getChunkNrows(Grid2DSquareCellAbstract.ChunkID chunkID,
                               boolean handleOutOfMemoryError)
Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract thats number of rows is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNrows

protected final int getChunkNrows(Grid2DSquareCellAbstract.ChunkID chunkID)
Returns chunkNrows, the number of rows in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract thats number of rows is returned.

getChunkNcols

public final int getChunkNcols(Grid2DSquareCellAbstract.ChunkID chunkID,
                               boolean handleOutOfMemoryError)
Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract thats number of columns is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkNcols

protected final int getChunkNcols(Grid2DSquareCellAbstract.ChunkID chunkID)
Returns chunkNcols, the number of columns in Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract thats number of columns is returned.

getDimensions

public final java.math.BigDecimal[] getDimensions(boolean handleOutOfMemoryError)
Returns a copy of this.dimensions.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellsizeDouble

public final double getCellsizeDouble(boolean handleOutOfMemoryError)
Returns a double equal to this.dimensions[0].doubleValue.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getDimensionsScale

protected final int getDimensionsScale(boolean handleOutOfMemoryError)
Returns a copy of this.dimensionsScale.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

initDimensions

protected final void initDimensions(java.math.BigDecimal[] dimensions)
Initialises this.dimensions and this.dimensionScale.


getCellDouble

public double getCellDouble(java.awt.geom.Point2D.Double point,
                            boolean handleOutOfMemoryError)
Returns Grid2DSquareCellChunkAbstract cell value at at Point2D.Double point as a double.

Parameters:
point - The Point2D.Double for which the cell value is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellDouble

protected double getCellDouble(java.awt.geom.Point2D.Double point)
Returns Grid2DSquareCellChunkAbstract cell value at at Point2D.Double point as a double.

Parameters:
point - The Point2D.Double for which the cell value is returned.

getCellDouble

public double getCellDouble(double x,
                            double y,
                            boolean handleOutOfMemoryError)
Returns Grid2DSquareCellChunkAbstract cell value at at point given by x-coordinate x and y-coordinate y as a double.

Parameters:
x - The x coordinate of the point at which the cell value is returned.
y - The y coordinate of the point at which the cell value is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellDouble

protected double getCellDouble(double x,
                               double y)
Returns Grid2DSquareCellChunkAbstract cell value at at point given by x-coordinate x and y-coordinate y as a double.

Parameters:
x - The x coordinate of the point at which the cell value is returned.
y - The y coordinate of the point at which the cell value is returned.

getCellDouble

public double getCellDouble(long cellRowIndex,
                            long cellColIndex,
                            boolean handleOutOfMemoryError)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.

Parameters:
cellRowIndex - The cell row index of the .
cellColIndex - The cell column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellDouble

protected double getCellDouble(long cellRowIndex,
                               long cellColIndex)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.

Parameters:
cellRowIndex - The cell row index of the .
cellColIndex - The cell column index.

getCellDouble

public double getCellDouble(int chunkRowIndex,
                            int chunkColIndex,
                            int chunkCellRowIndex,
                            int chunkCellColIndex,
                            boolean handleOutOfMemoryError)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.

Parameters:
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellDouble

protected double getCellDouble(int chunkRowIndex,
                               int chunkColIndex,
                               int chunkCellRowIndex,
                               int chunkCellColIndex)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a double.

Parameters:
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.

getCellDouble

public double getCellDouble(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk,
                            int chunkRowIndex,
                            int chunkColIndex,
                            int chunkCellRowIndex,
                            int chunkCellColIndex,
                            boolean handleOutOfMemoryError)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a double.

Parameters:
grid2DSquareCellChunk - The Grid2DSquareCellChunkAbstract containing the cell.
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellDouble

protected double getCellDouble(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk,
                               int chunkRowIndex,
                               int chunkColIndex,
                               int chunkCellRowIndex,
                               int chunkCellColIndex)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a double.

Parameters:
grid2DSquareCellChunk - The Grid2DSquareCellChunkAbstract containing the cell.
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.

getCellInt

public int getCellInt(long cellRowIndex,
                      long cellColIndex,
                      boolean handleOutOfMemoryError)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a int.

Parameters:
cellRowIndex - The cell row index.
cellColIndex - The cell column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellInt

protected int getCellInt(long cellRowIndex,
                         long cellColIndex)
Returns Grid2DSquareCellChunkAbstract cell value at cell row index equal to cellRowIndex, cell col index equal to cellColIndex as a int.

Parameters:
cellRowIndex - The cell row index.
cellColIndex - The cell column index.

getCellInt

public int getCellInt(int chunkRowIndex,
                      int chunkColIndex,
                      int chunkCellRowIndex,
                      int chunkCellColIndex,
                      boolean handleOutOfMemoryError)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.

Parameters:
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellInt

protected int getCellInt(int chunkRowIndex,
                         int chunkColIndex,
                         int chunkCellRowIndex,
                         int chunkCellColIndex)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.

Parameters:
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.

getCellInt

public int getCellInt(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk,
                      int chunkRowIndex,
                      int chunkColIndex,
                      int chunkCellRowIndex,
                      int chunkCellColIndex,
                      boolean handleOutOfMemoryError)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.

Parameters:
grid2DSquareCellChunk - The Grid2DSquareCellChunkAbstract containing the cell.
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellInt

protected int getCellInt(Grid2DSquareCellChunkAbstract grid2DSquareCellChunk,
                         int chunkRowIndex,
                         int chunkColIndex,
                         int chunkCellRowIndex,
                         int chunkCellColIndex)
Returns the cell value at chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex of Grid2DSquareCellChunkAbstract given by chunk row index chunkRowIndex, chunk col index chunkColIndex as a int.

Parameters:
grid2DSquareCellChunk - The Grid2DSquareCellChunkAbstract containing the cell.
chunkRowIndex - The cell chunk row index.
chunkColIndex - The cell chunk column index.
chunkCellRowIndex - The cell row index of the chunk.
chunkCellColIndex - The cell column index of the chunk.

setCell

public abstract double setCell(long cellRowIndex,
                               long cellColIndex,
                               double valueToSet,
                               boolean handleOutOfMemoryError)
Returns the value at cellRowIndex, cellColIndex as a double and sets it to valueToSet.

Parameters:
cellRowIndex - The cell row index.
cellColIndex - The cell column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkColIndex

public final int getChunkColIndex(double x,
                                  boolean handleOutOfMemoryError)
Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the chunk column index returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkColIndex

protected final int getChunkColIndex(double x)
Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the chunk column index returned.

getChunkColIndex

public final int getChunkColIndex(long cellColIndex,
                                  boolean handleOutOfMemoryError)
Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the cell column index cellColIndex.

Parameters:
cellColIndex -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkColIndex

protected final int getChunkColIndex(long cellColIndex)
Returns the chunk column index for the Grid2DSquareCellChunkAbstract intersecting the cell column index cellColIndex.

Parameters:
cellColIndex -

getCellColIndex

public final long getCellColIndex(double x,
                                  boolean handleOutOfMemoryError)
Returns the cell column Index for the cell column that intersect the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the cell column index returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellColIndex

protected final long getCellColIndex(double x)
Returns the cell column Index for the cell column that intersect the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the cell column index returned.

getCellColIndex

public final long getCellColIndex(java.math.BigDecimal xBigDecimal,
                                  boolean handleOutOfMemoryError)
Returns the cell column Index for the cell column that intersect the x-coordinate xBigDecimal.

Parameters:
xBigDecimal - The x-coordinate of the line intersecting the cell column index returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellColIndex

protected final long getCellColIndex(java.math.BigDecimal xBigDecimal)
Returns the cell column Index for the cell column that intersect the x-coordinate xBigDecimal.

Parameters:
xBigDecimal - The x-coordinate of the line intersecting the cell column index returned.

getChunkCellColIndex

public final int getChunkCellColIndex(double x,
                                      boolean handleOutOfMemoryError)
Returns the chunk cell column Index of the cells that intersect the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the chunk cell column index returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkCellColIndex

protected final int getChunkCellColIndex(double x)
Returns the chunk cell column Index of the cells that intersect the x-coordinate x.

Parameters:
x - The x-coordinate of the line intersecting the chunk cell column index returned.

getChunkCellColIndex

public final int getChunkCellColIndex(long cellColIndex,
                                      boolean handleOutOfMemoryError)
Returns the chunk cell column index of the cells in the cell column index cellColIndex.

Parameters:
cellColIndex - The cell column index of the cell thats chunk cell column index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkCellColIndex

protected final int getChunkCellColIndex(long cellColIndex)
Returns the chunk cell column index of the cells in the cell column index cellColIndex.

Parameters:
cellColIndex - The cell column index of the cell thats chunk cell column index is returned.

getChunkRowIndex

public final int getChunkRowIndex(double y,
                                  boolean handleOutOfMemoryError)
Returns the chunk row index for the chunks intersecting the line given by y-coordinate y.

Parameters:
y - The y-coordinate of the line for which the chunk row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkRowIndex

protected final int getChunkRowIndex(double y)
Returns the chunk row index for the chunks intersecting the line given by y-coordinate y.

Parameters:
y - The y-coordinate of the line for which the chunk row index is returned.

getChunkRowIndex

public final int getChunkRowIndex(long cellRowIndex,
                                  boolean handleOutOfMemoryError)
Returns the chunk row index for the chunk intersecting the cells with cell row index cellRowIndex.

Parameters:
cellRowIndex - The cell row index of the cells thats chunk row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkRowIndex

protected final int getChunkRowIndex(long cellRowIndex)
Returns the chunk row index for the chunk intersecting the cells with cell row index cellRowIndex.

Parameters:
cellRowIndex - The cell row index of the cells thats chunk row index is returned.

getCellRowIndex

public final long getCellRowIndex(double y,
                                  boolean handleOutOfMemoryError)
Returns the cell row Index for the cells that intersect the line with y-coordinate y.

Parameters:
y - The y-coordinate of the line thats cell row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellRowIndex

protected final long getCellRowIndex(double y)
Returns the cell row Index for the cells that intersect the line with y-coordinate y.

Parameters:
y - The y-coordinate of the line thats cell row index is returned.

getCellRowIndex

public final long getCellRowIndex(java.math.BigDecimal yBigDecimal,
                                  boolean handleOutOfMemoryError)
Returns the cell row Index for the cells that intersect the line with y-coordinate yBigDecimal.

Parameters:
yBigDecimal - The y-coordinate of the line for which the cell row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellRowIndex

protected final long getCellRowIndex(java.math.BigDecimal yBigDecimal)
Returns the cell row Index for the cells that intersect the line with y-coordinate yBigDecimal.

Parameters:
yBigDecimal - The y-coordinate of the line for which the cell row index is returned.

getChunkCellRowIndex

public final int getChunkCellRowIndex(double y,
                                      boolean handleOutOfMemoryError)
Returns the chunk cell row Index of the cells that intersects the line with y-coordinate y.

Parameters:
y - The y-coordinate of the line for which the chunk cell row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkCellRowIndex

protected final int getChunkCellRowIndex(double y)
Returns the chunk cell row Index of the cells that intersects the line with y-coordinate y.

Parameters:
y - The y-coordinate of the line for which the chunk cell row index is returned.

getChunkCellRowIndex

public final int getChunkCellRowIndex(long cellRowIndex,
                                      boolean handleOutOfMemoryError)
Returns the chunk cell row index of the cells with cell row index equal to cellRowIndex.

Parameters:
cellRowIndex - The cell row index of the cells that chunk cell row index is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkCellRowIndex

protected final int getChunkCellRowIndex(long cellRowIndex)
Returns the chunk cell row index of the cells with cell row index equal to cellRowIndex.

Parameters:
cellRowIndex - The cell row index of the cells that chunk cell row index is returned.

getCellID

public final Grid2DSquareCellAbstract.CellID getCellID(long cellRowIndex,
                                                       long cellColIndex,
                                                       boolean handleOutOfMemoryError)
Returns a new CellID of the cell given by cell row index cellRowIndex, cell column index cellColIndex. A CellID is returned even if that cell would not be in the grid.

Parameters:
cellRowIndex - The cell row index.
cellColIndex - The cell column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellID

protected final Grid2DSquareCellAbstract.CellID getCellID(long cellRowIndex,
                                                          long cellColIndex)
Returns a new CellID of the cell given by cell row index cellRowIndex, cell column index cellColIndex. A CellID is returned even if that cell would not be in the grid.

Parameters:
cellRowIndex - The cell row index.
cellColIndex - The cell column index.

getCellID

public final Grid2DSquareCellAbstract.CellID getCellID(double x,
                                                       double y,
                                                       boolean handleOutOfMemoryError)
Returns a CellID of the cell given by x-coordinate x, y-coordinate y even if that cell would not be in the grid.

Parameters:
x - The x-coordinate.
y - The y-coordinate.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellID

protected final Grid2DSquareCellAbstract.CellID getCellID(double x,
                                                          double y)
Returns a CellID of the cell given by x-coordinate x, y-coordinate y even if that cell would not be in the grid.

Parameters:
x - The x-coordinate.
y - The y-coordinate.

writeToFile

public final void writeToFile(boolean swapToFileCache,
                              boolean handleOutOfMemoryError)
                       throws java.io.IOException
A method to write this instance to Files located in the directory returned by getDirectory().

Parameters:
swapToFileCache - Iff true then this.grid2DSquareCellChunks is written to new File( getDirectory(), "cache" ).
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Throws:
java.io.IOException

writeToFile

protected void writeToFile(boolean swapToFileCache)
                    throws java.io.IOException
A method to write this instance to Files located in the directory returned by getDirectory().

Parameters:
swapToFileCache - Iff true then this.grid2DSquareCellChunks is written to new File(getDirectory(),"cache").
Throws:
java.io.IOException

writeToFileGrid2DSquareCellChunk

public final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks. The first Grid2DSquareCellChunkAbstract attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract which was written to file.

writeToFileGrid2DSquareCellChunk

protected final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunk()
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks. The first Grid2DSquareCellChunkAbstract attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Returns:
ChunkID of the Grid2DSquareCellChunkAbstract which was swapped or null.

writeToFileGrid2DSquareCellChunk

public final boolean writeToFileGrid2DSquareCellChunk(int chunkRowIndex,
                                                      int chunkColIndex,
                                                      boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by; chunk row index chunkRowIndex, chunk column index chunkColIndex.

Parameters:
chunkRowIndex - The chunk row index of the Grid2DSquareCellChunkAbstract to be written.
chunkColIndex - The chunk column index of the Grid2DSquareCellChunkAbstract to be written.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
True if Grid2DSquareCellChunkAbstract on file is up to date.

writeToFileGrid2DSquareCellChunk

protected final boolean writeToFileGrid2DSquareCellChunk(int chunkRowIndex,
                                                         int chunkColIndex)
A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by; chunk row index chunkRowIndex, chunk column index chunkColIndex.

Parameters:
chunkRowIndex - The chunk row index of the Grid2DSquareCellChunkAbstract to be written.
chunkColIndex - The chunk column index of the Grid2DSquareCellChunkAbstract to be written.
Returns:
True if Grid2DSquareCellChunkAbstract on file is up to date.

writeToFileGrid2DSquareCellChunk

public final boolean writeToFileGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                      boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by chunkID.

Parameters:
chunkID - The chunkID of the Grid2DSquareCellChunkAbstract to be written.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
True if Grid2DSquareCellChunkAbstract on file is up to date.

writeToFileGrid2DSquareCellChunk

protected final boolean writeToFileGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
A method that attempts to write to File a seriailized version of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks given by chunkID.

Parameters:
chunkID - The chunkID of the Grid2DSquareCellChunkAbstract to be written.
Returns:
True if Grid2DSquareCellChunkAbstract on file is up to date.

writeToFileGrid2DSquareCellChunks

public final void writeToFileGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
A method that attempts to write to File seriailized versions of all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

writeToFileGrid2DSquareCellChunks

protected final void writeToFileGrid2DSquareCellChunks()
A method that attempts to write to File seriailized versions of all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.


writeToFileGrid2DSquareCellChunks

public final void writeToFileGrid2DSquareCellChunks(java.util.HashSet chunkIDs,
                                                    boolean handleOutOfMemoryError)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks that have ChunkID equal to those in chunkIDs.

Parameters:
chunkIDs - A HashSet containing the ChunkID of the Grid2DSquareCellChunkAbstract to be written to file.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

writeToFileGrid2DSquareCellChunks

protected final void writeToFileGrid2DSquareCellChunks(java.util.HashSet chunkIDs)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks that have ChunkID equal to those in chunkIDs.

Parameters:
chunkIDs - A HashSet containing the ChunkID of the Grid2DSquareCellChunkAbstract to be written to file.

writeToFileGrid2DSquareCellChunksExcept

public final void writeToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                          boolean handleOutOfMemoryError)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the chunk not to be written.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

writeToFileGrid2DSquareCellChunksExcept

protected final void writeToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the chunk not to be written.

writeToFileGrid2DSquareCellChunkExcept

public final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                                     boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID. The first chunk that is attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Parameters:
chunkID - The ChunkID of the chunk not to be swapToFiled.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExcept

protected final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with ChunkID equal to chunkID. The first chunk that is attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Parameters:
chunkID - The ChunkID of the chunk not to be swapToFiled.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExcept

public final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(int chunkRowIndex,
                                                                                     int chunkColIndex,
                                                                                     boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Parameters:
chunkRowIndex - The chunk row index.
chunkColIndex - The chunk column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExcept

protected final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExcept(int chunkRowIndex,
                                                                                        int chunkColIndex)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of 0, and a chunk column index of 0.

Parameters:
chunkRowIndex - The chunk row index.
chunkColIndex - The chunk column index.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExceptReverseOrder

public final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(int chunkRowIndex,
                                                                                                 int chunkColIndex,
                                                                                                 boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of chunkNrows - 1, and a chunk column index of chunkNcols - 1. This is primarily used in constructors that read a data format that

Parameters:
chunkRowIndex - The chunk row index.
chunkColIndex - The chunk column index.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null. presents values in reverse row order.

writeToFileGrid2DSquareCellChunkExceptReverseOrder

protected final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(int chunkRowIndex,
                                                                                                    int chunkColIndex)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of chunkNrows - 1, and a chunk column index of chunkNcols - 1. This is primarily used in constructors that read a data format that presents values in reverse row order.

Parameters:
chunkRowIndex - The chunk row index.
chunkColIndex - The chunk column index.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExceptReverseOrder

public final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                                                 boolean handleOutOfMemoryError)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of chunkNrows - 1, and a chunk column index of chunkNcols - 1. This is primarily used in constructors that read a data format that presents values in reverse row order.

Parameters:
chunkID - The ChunkID of the chunk not to be swapToFiled.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
ChunkID of the Grid2DSquareCellChunkAbstract that is written or null.

writeToFileGrid2DSquareCellChunkExceptReverseOrder

protected final Grid2DSquareCellAbstract.ChunkID writeToFileGrid2DSquareCellChunkExceptReverseOrder(Grid2DSquareCellAbstract.ChunkID chunkID)
A method that attempts to write to File a seriailized version of a Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except that with; chunk row index chunkRowIndex, chunk column index chunkColIndex. The first chunk that is attempted to be written is that with a chunk row index of chunkNrows - 1, and a chunk column index of chunkNcols - 1. This is primarily used in constructors that read a data format that presents values in reverse row order.

Parameters:
chunkID - The ChunkID of the chunk not to be swapToFiled.

writeToFileGrid2DSquareCellChunksExcept

public final void writeToFileGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs,
                                                          boolean handleOutOfMemoryError)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except those that have ChunkID in chunkIDs.

Parameters:
chunkIDs - A hashSet containing ChunkIDs not to be swapToFiled.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

writeToFileGrid2DSquareCellChunksExcept

protected final void writeToFileGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs)
A method that attempts to write to File seriailized versions of those Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks except those that have ChunkID in chunkIDs.

Parameters:
chunkIDs - A hashSet containing ChunkIDs not to be swapToFiled.

swapToFileGrid2DSquareCellChunk

public final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The ChunkID of Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellChunk

protected final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunk()
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Returns:
The ChunkID of Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellChunkExcept

public final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                                    boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The ChunkID of Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellChunkExcept

protected final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Returns:
The ChunkID of Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellChunksExcept

public final long swapToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                         boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunksExcept

protected final long swapToFileGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this except that with ChunkID chunkID.

Parameters:
chunkID - ChunkID of the Grid2DSquareCellChunkAbstract not to be swapped.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunkExcept

public final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(java.util.HashSet chunkIDs,
                                                                                    boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The ChunkID of the Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellChunkExcept

protected final Grid2DSquareCellAbstract.ChunkID swapToFileGrid2DSquareCellChunkExcept(java.util.HashSet chunkIDs)
Attempts to write to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Returns:
The ChunkID of the Grid2DSquareCellChunkAbstract swapped or null.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunks

public final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache all Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunks

protected final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunks()
Attempts to write to file and clear from the cache all Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept

public final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                          boolean handleOutOfMemoryError)
Attempts to swap to file and clear from the cache the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells that do not have a ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells not to swap and clear from cache.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept

protected final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
Attempts to swap to file and clear from the cache the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells that do not have a ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract in this.grid2DSquareCells not to swap and clear from cache.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunk

public final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunk(boolean handleOutOfMemoryError)
Attempts to swap to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunk

protected final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunk()
Attempts to swap to file and clear from the cache a Grid2DSquareCellChunkAbstract in this.grid2DSquareCells.

Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept

public final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                         boolean handleOutOfMemoryError)
Attempts to write to file and clear from the cache (swap) a Grid2DSquareCellChunkAbstract in each Grid2DSquareCellAbstract of this.grid2DSquareCells. All Grid2DSquareCellChunkAbstract written have equal ChunkID that are not equal to chunkID.

Parameters:
chunkID - The ID of Chunks not to swap and clear from cache.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept

protected final long swapToFileGrid2DSquareCellsGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
Attempts to write to file and clear from the cache (swap) a Grid2DSquareCellChunkAbstract in each Grid2DSquareCellAbstract of this.grid2DSquareCells. All Grid2DSquareCellChunkAbstract written have equal ChunkID that are not equal to chunkID.

Parameters:
chunkID - The ID of Chunks not to swap and clear from cache.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunks

public final long swapToFileGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
Attempts to swap seriailsed version of all grid2DSquareCellChunks. This involves writing them to files and then clearing them from the cache.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunks

protected final long swapToFileGrid2DSquareCellChunks()
Attempts to swap seriailsed version of all grid2DSquareCellChunks. This involves writing them to files and then clearing them from the cache.

Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunks

public final long swapToFileGrid2DSquareCellChunks(int cri0,
                                                   int cci0,
                                                   int cri1,
                                                   int cci1,
                                                   boolean handleOutOfMemoryError)
Attempts to swap seriailsed version of all Grid2DSquareCellChunk from (cri0, cci0) to (cri1, cci1) in row major order. This involves writing them to files and then clearing them from the cache.

Parameters:
cri0 - The chunk row index of the first Grid2DSquareCellChunk to be swapped.
cci0 - The chunk column index of the first Grid2DSquareCellChunk to be swapped.
cri1 - The chunk row index of the last Grid2DSquareCellChunk to be swapped.
cci1 - The chunk column index of the last Grid2DSquareCellChunk to be swapped.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

swapToFileGrid2DSquareCellChunks

protected final long swapToFileGrid2DSquareCellChunks(int cri0,
                                                      int cci0,
                                                      int cri1,
                                                      int cci1)
Attempts to swap seriailsed version of all Grid2DSquareCellChunk from (cri0, cci0) to (cri1, cci1) in row major order. This involves writing them to files and then clearing them from the cache.

Parameters:
cri0 - The chunk row index of the first Grid2DSquareCellChunks to be swapped.
cci0 - The chunk column index of the first Grid2DSquareCellChunks to be swapped.
cri1 - The chunk row index of the last Grid2DSquareCellChunks to be swapped.
cci1 - The chunk column index of the last Grid2DSquareCellChunks to be swapped.
Returns:
The number of Grid2DSquareCellChunkAbstract swapped.

isInCache

public final boolean isInCache(Grid2DSquareCellAbstract.ChunkID chunkID,
                               boolean handleOutOfMemoryError)
Returns true iff grid2DSquareCellChunk given by chunkID is in memory.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk tested to see if it is swapToFiled.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInCache

protected final boolean isInCache(Grid2DSquareCellAbstract.ChunkID chunkID)
Returns true iff grid2DSquareCellChunk given by chunkID is swapToFiled. This must be an upToDate swapToFile.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk tested to see if it is swapToFiled.

clearFromCacheGrid2DSquareCellChunk

protected final void clearFromCacheGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                         boolean handleOutOfMemoryError)
For releasing a grid2DSquareCellChunk stored in memory. This is usually only done after the equivallent of swapToFileChunk(ChunkID) has been called.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk to be cleared.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunk

protected final void clearFromCacheGrid2DSquareCellChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
For releasing a grid2DSquareCellChunk stored in memory. This is usually only done after the equivallent of swapToFileChunk(ChunkID) has been called.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk to be cleared.

clearFromCacheGrid2DSquareCellChunks

protected final void clearFromCacheGrid2DSquareCellChunks(boolean handleOutOfMemoryError)
For releasing all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunks

protected final void clearFromCacheGrid2DSquareCellChunks()
For releasing all Grid2DSquareCellChunkAbstract in this.grid2DSquareCellChunks.


clearFromCacheGrid2DSquareCellChunks

protected final void clearFromCacheGrid2DSquareCellChunks(java.util.HashSet chunkIDs,
                                                          boolean handleOutOfMemoryError)
Clears Grid2DSquareCellChunkAbstracts with ChunkIDs in chunkIDs.

Parameters:
chunkIDs - A HashSet containing the ChunkIDs of the Grid2DSquareCellChunkAbstracts to be cleared.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunks

protected final void clearFromCacheGrid2DSquareCellChunks(java.util.HashSet chunkIDs)
Clears Grid2DSquareCellChunkAbstracts with ChunkIDs in chunkIDs.

Parameters:
chunkIDs - A HashSet containing the ChunkIDs of the Grid2DSquareCellChunkAbstracts to be cleared.

clearFromCacheGrid2DSquareCellChunkExcept

protected final void clearFromCacheGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                               boolean handleOutOfMemoryError)
For releasing a grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk not to be cleared.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunkExcept

protected final void clearFromCacheGrid2DSquareCellChunkExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
For releasing a grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk not to be cleared.

clearFromCacheGrid2DSquareCellChunksExcept

protected final void clearFromCacheGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                boolean handleOutOfMemoryError)
For releasing all grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk not to be cleared.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunksExcept

protected final void clearFromCacheGrid2DSquareCellChunksExcept(Grid2DSquareCellAbstract.ChunkID chunkID)
For releasing all grid2DSquareCellChunk stored in memory except that with ChunkID given by chunkID.

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk not to be cleared.

clearFromCacheGrid2DSquareCellChunksExcept

protected final void clearFromCacheGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs,
                                                                boolean handleOutOfMemoryError)
For releasing all grid2DSquareCellChunk stored in memory except those with ChunkIDs in chunkIDs.

Parameters:
chunkIDs - The HashSet of ChunkIDs of the grid2DSquareCellChunks not to be cleared.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

clearFromCacheGrid2DSquareCellChunksExcept

protected final void clearFromCacheGrid2DSquareCellChunksExcept(java.util.HashSet chunkIDs)
For releasing all grid2DSquareCellChunk stored in memory except those with ChunkIDs in chunkIDs.

Parameters:
chunkIDs - The HashSet of ChunkIDs of the grid2DSquareCellChunks not to be cleared.

loadIntoCacheChunk

public final void loadIntoCacheChunk(int chunkRowIndex,
                                     int chunkColIndex,
                                     boolean handleOutOfMemoryError)
Restores a grid2DSquareCellChunk from a swapped cache file.

Parameters:
chunkRowIndex - The chunk row index of the grid2DSquareCellChunk to be restored.
chunkColIndex - The chunk column index of the grid2DSquareCellChunk to be restored.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

loadIntoCacheChunk

protected final void loadIntoCacheChunk(int chunkRowIndex,
                                        int chunkColIndex)
Restores a grid2DSquareCellChunk from a swapped cache file.

Parameters:
chunkRowIndex - The chunk row index of the grid2DSquareCellChunk to be restored.
chunkColIndex - The chunk column index of the grid2DSquareCellChunk to be restored.

loadIntoCacheChunk

public final void loadIntoCacheChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                     boolean handleOutOfMemoryError)
Attempts to load into the memory cache a AbstractGrid2DSquareCellChunk with ChunkID

Parameters:
chunkID - The ChunkID of the grid2DSquareCellChunk to be restored.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

loadIntoCacheChunk

protected final void loadIntoCacheChunk(Grid2DSquareCellAbstract.ChunkID chunkID)
Attempts to load into the memory cache Grid2DSquareCellChunkAbstract with ChunkID equal to chunkID.

Parameters:
chunkID - The ChunkID of the Grid2DSquareCellChunkAbstract to be restored.

getCellIDs

public final Grid2DSquareCellAbstract.CellID[] getCellIDs(double x,
                                                          double y,
                                                          double distance,
                                                          boolean handleOutOfMemoryError)
Returns a CellID[] - the cell IDs for cells thats centroids are intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.

Parameters:
x - the x-coordinate of the circle centre from which cell values are returned.
y - the y-coordinate of the circle centre from which cell values are returned.
distance - the radius of the circle for which intersected cell values are returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellIDs

protected final Grid2DSquareCellAbstract.CellID[] getCellIDs(double x,
                                                             double y,
                                                             double distance)
Returns a CellID[] - the cell IDs for cells thats centroids are intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.

Parameters:
x - the x-coordinate of the circle centre from which cell values are returned.
y - the y-coordinate of the circle centre from which cell values are returned.
distance - the radius of the circle for which intersected cell values are returned.

getCellIDs

public final Grid2DSquareCellAbstract.CellID[] getCellIDs(long cellRowIndex,
                                                          long cellColIndex,
                                                          double distance,
                                                          boolean handleOutOfMemoryError)
Returns a CellID[] - the cell IDs for cells thats centroids would be intersected by circle with centre at centroid of cell given by cell row index cellRowIndex, cell column index cellColIndex, and radius distance.

Parameters:
cellRowIndex - the row index for the cell thats centroid is the circle centre from which cell values are returned.
cellColIndex - the column index for the cell thats centroid is the circle centre from which cell values are returned.
distance - the radius of the circle for which intersected cell values are returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellIDs

protected final Grid2DSquareCellAbstract.CellID[] getCellIDs(long cellRowIndex,
                                                             long cellColIndex,
                                                             double distance)
Returns a CellID[] - the cell IDs for cells thats centroids would be intersected by circle with centre at centroid of cell given by cell row index cellRowIndex, cell column index cellColIndex, and radius distance.

Parameters:
cellRowIndex - the row index for the cell thats centroid is the circle centre from which cell values are returned.
cellColIndex - the column index for the cell thats centroid is the circle centre from which cell values are returned.
distance - the radius of the circle for which intersected cell values are returned.

getCellIDs

public Grid2DSquareCellAbstract.CellID[] getCellIDs(double x,
                                                    double y,
                                                    long cellRowIndex,
                                                    long cellColIndex,
                                                    double distance,
                                                    boolean handleOutOfMemoryError)
Returns double[] cells - the values for cells thats centroids would be intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.

Parameters:
x - the x-coordinate of the circle centre from which cell values are returned.
y - the y-coordinate of the circle centre from which cell values are returned.
cellRowIndex - the row index at y.
cellColIndex - the col index at x.
distance - the radius of the circle for which intersected cell values are returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellIDs

protected Grid2DSquareCellAbstract.CellID[] getCellIDs(double x,
                                                       double y,
                                                       long cellRowIndex,
                                                       long cellColIndex,
                                                       double distance)
Returns double[] cells - the values for cells thats centroids would be intersected by circle with centre at x-coordinate x, y-coordinate y, and radius distance.

Parameters:
x - the x-coordinate of the circle centre from which cell values are returned.
y - the y-coordinate of the circle centre from which cell values are returned.
cellRowIndex - the row index at y.
cellColIndex - the col index at x.
distance - the radius of the circle for which intersected cell values are returned. TODO: remove need for copy to new array.

getNearestCellID

public Grid2DSquareCellAbstract.CellID getNearestCellID(double x,
                                                        double y,
                                                        boolean handleOutOfMemoryError)
Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by x-coordinate x, y-coordinate y.

Parameters:
x - the x-coordinate of the point.
y - the y-coordinate of the point.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNearestCellID

protected Grid2DSquareCellAbstract.CellID getNearestCellID(double x,
                                                           double y)
Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by x-coordinate x, y-coordinate y.

Parameters:
x - the x-coordinate of the point.
y - the y-coordinate of the point.

getNearestCellID

public Grid2DSquareCellAbstract.CellID getNearestCellID(long cellRowIndex,
                                                        long cellColIndex,
                                                        boolean handleOutOfMemoryError)
Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by cell row index cellRowIndex, cell column index cellColIndex.

Parameters:
cellRowIndex - the row index from which nearest cell ID is returned.
cellColIndex - the column index from which nearest cell ID is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: return CellID[] as could be more than one nearest CellID

getNearestCellID

protected Grid2DSquareCellAbstract.CellID getNearestCellID(long cellRowIndex,
                                                           long cellColIndex)
Returns the the nearest cells cellRowIndex and cellColIndex as a long[] from ID to point given by cell row index cellRowIndex, cell column index cellColIndex.

Parameters:
cellRowIndex - the row index from which nearest cell ID is returned.
cellColIndex - the column index from which nearest cell ID is returned. TODO: return CellID[] as could be more than one nearest CellID

getNearestCellID

public Grid2DSquareCellAbstract.CellID getNearestCellID(double x,
                                                        double y,
                                                        long cellRowIndex,
                                                        long cellColIndex,
                                                        boolean handleOutOfMemoryError)
Returns the the nearest CellID to point given by x-coordinate x, y-coordinate y in position given by cellRowIndex, cellColIndex.

Parameters:
x - The x-coordinate of the point.
y - The y-coordinate of the point.
cellRowIndex - The cell row index of cell containing point.
cellColIndex - The cell column index of cell containing point.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getNearestCellID

protected Grid2DSquareCellAbstract.CellID getNearestCellID(double x,
                                                           double y,
                                                           long cellRowIndex,
                                                           long cellColIndex)
Returns the the nearest CellID to point given by x-coordinate x, y-coordinate y in position given by cellRowIndex, cellColIndex.

Parameters:
x - The x-coordinate of the point.
y - The y-coordinate of the point.
cellRowIndex - The cell row index of cell containing point.
cellColIndex - The cell column index of cell containing point.

getHeightDouble

public final double getHeightDouble(boolean handleOutOfMemoryError)
Returns the height of the grid.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getHeightDouble

protected final double getHeightDouble()
Returns the height of the grid.


getHeightBigDecimal

public final java.math.BigDecimal getHeightBigDecimal(boolean handleOutOfMemoryError)
Returns the height of the grid.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getHeightBigDecimal

protected final java.math.BigDecimal getHeightBigDecimal()
Returns the height of the grid.


getWidthDouble

public final double getWidthDouble(boolean handleOutOfMemoryError)
Returns the width of the grid as a double.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getWidthDouble

protected final double getWidthDouble()
Returns the width of the grid as a double.


getWidthBigDecimal

public final java.math.BigDecimal getWidthBigDecimal(boolean handleOutOfMemoryError)
Returns the width of the grid as a BigDecimal.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getWidthBigDecimal

protected final java.math.BigDecimal getWidthBigDecimal()
Returns the width of the grid as a BigDecimal.


isInGrid

public final boolean isInGrid(java.math.BigDecimal xBigDecimal,
                              java.math.BigDecimal yBigDecimal,
                              boolean handleOutOfMemoryError)
Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid. Anything on the boundary is considered to be in.

Parameters:
xBigDecimal - The x-coordinate of the point.
yBigDecimal - The y-coordinate of the point.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(java.math.BigDecimal xBigDecimal,
                                 java.math.BigDecimal yBigDecimal)
Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid. Anything on the boundary is considered to be in.

Parameters:
xBigDecimal - The x-coordinate of the point.
yBigDecimal - The y-coordinate of the point.

isInGrid

public final boolean isInGrid(double x,
                              double y,
                              boolean handleOutOfMemoryError)
Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid. Anything on the boundary is considered to be in.

Parameters:
x - The x-coordinate of the point.
y - The y-coordinate of the point.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(double x,
                                 double y)
Returns true iff point given by x-coordinate x, y-coordinate y is in the Grid. Anything on the boundary is considered to be in.

Parameters:
x - The x-coordinate of the point.
y - The y-coordinate of the point.

isInGrid

public final boolean isInGrid(long cellRowIndex,
                              long cellColIndex,
                              boolean handleOutOfMemoryError)
Returns true iff position given by cell row index cellRowIndex, cell column index cellColIndex is in the Grid.

Parameters:
cellRowIndex - The cell row index to test.
cellColIndex - The cell column index to test.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(long cellRowIndex,
                                 long cellColIndex)
Returns true iff position given by cell row index cellRowIndex, cell column index cellColIndex is in the Grid.

Parameters:
cellRowIndex - The cell row index to test.
cellColIndex - The cell column index to test.

isInGrid

public final boolean isInGrid(int chunkRowIndex,
                              int chunkColIndex,
                              boolean handleOutOfMemoryError)
Returns true iff position given by chunk row index chunkRowIndex, chunk column index chunkColIndex is in the Grid.

Parameters:
chunkRowIndex - The chunk row index to test.
chunkColIndex - The chunk column index to test.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(int chunkRowIndex,
                                 int chunkColIndex)
Returns true iff position given by chunk row index chunkRowIndex, chunk column index chunkColIndex is in the Grid.

Parameters:
chunkRowIndex - The chunk row index to test.
chunkColIndex - The chunk column index to test.

isInGrid

public final boolean isInGrid(Grid2DSquareCellAbstract.CellID cellID,
                              boolean handleOutOfMemoryError)
Returns true iff cell given by cellID is in the Grid.

Parameters:
cellID - The CellID of a cell to test.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(Grid2DSquareCellAbstract.CellID cellID)
Returns true iff cell given by cellID is in the Grid.

Parameters:
cellID - The CellID of a cell to test.

isInGrid

public final boolean isInGrid(Grid2DSquareCellAbstract.ChunkID chunkID,
                              boolean handleOutOfMemoryError)
Returns true iff ChunkID chunkID is in the Grid.

Parameters:
chunkID - The ChunkID of a cell to test.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(Grid2DSquareCellAbstract.ChunkID chunkID)
Returns true iff ChunkID chunkID is in the Grid.

Parameters:
chunkID - The ChunkID of a cell to test.

isInGrid

public final boolean isInGrid(int chunkRowIndex,
                              int chunkColIndex,
                              int chunkCellRowIndex,
                              int chunkCellColIndex,
                              boolean handleOutOfMemoryError)
Returns true iff cell given by chunkRowIndex, chunkColIndex, chunkCellRowIndex, chunkCellColIndex is in the Grid.

Parameters:
chunkRowIndex -
chunkColIndex -
chunkCellRowIndex -
chunkCellColIndex -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

isInGrid

protected final boolean isInGrid(int chunkRowIndex,
                                 int chunkColIndex,
                                 int chunkCellRowIndex,
                                 int chunkCellColIndex)
Returns true iff cell given by chunkRowIndex, chunkColIndex, chunkCellRowIndex, chunkCellColIndex is in the Grid.

Parameters:
chunkRowIndex -
chunkColIndex -
chunkCellRowIndex -
chunkCellColIndex -

getCellXBigDecimal

public final java.math.BigDecimal getCellXBigDecimal(long cellColIndex,
                                                     boolean handleOutOfMemoryError)
Returns the x-coordinate of the centroid for cells with column index cellColIndex as a BigDecimal.

Parameters:
cellColIndex - The cell column index thats centroid x-coordinate is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellXBigDecimal

protected final java.math.BigDecimal getCellXBigDecimal(long cellColIndex)
Returns the x-coordinate of the centroid for cells with column index cellColIndex as a BigDecimal.

Parameters:
cellColIndex - The cell column index thats centroid x-coordinate is returned.

getCellXDouble

public final double getCellXDouble(long cellColIndex,
                                   boolean handleOutOfMemoryError)
Returns the x-coordinate of the centroid for cells with column index cellColIndex as a double.

Parameters:
cellColIndex - The cell column index thats centroid x-coordinate is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellXDouble

protected final double getCellXDouble(long cellColIndex)
Returns the x-coordinate of the centroid for cells with column index cellColIndex as a double.

Parameters:
cellColIndex - The cell column index thats centroid x-coordinate is returned.

getCellXBigDecimal

public final java.math.BigDecimal getCellXBigDecimal(Grid2DSquareCellAbstract.CellID cellID,
                                                     boolean handleOutOfMemoryError)
Returns the x-coordinate of the centroid for cell with cell ID cellID as a BigDecimal.

Parameters:
cellID -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellXBigDecimal

protected final java.math.BigDecimal getCellXBigDecimal(Grid2DSquareCellAbstract.CellID cellID)
Returns the x-coordinate of the centroid for cell with cell ID cellID as a BigDecimal.

Parameters:
cellID -

getCellXDouble

public final double getCellXDouble(Grid2DSquareCellAbstract.CellID cellID,
                                   boolean handleOutOfMemoryError)
Returns the x-coordinate of the centroid for cell with cell ID cellID as a double

Parameters:
cellID -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellXDouble

protected final double getCellXDouble(Grid2DSquareCellAbstract.CellID cellID)
Returns the x-coordinate of the centroid for cell with cell ID cellID as a double

Parameters:
cellID -

getCellYBigDecimal

public final java.math.BigDecimal getCellYBigDecimal(long cellRowIndex,
                                                     boolean handleOutOfMemoryError)
Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a BigDecimal.

Parameters:
cellRowIndex - the cell column index thats centroid y-coordinate is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellYBigDecimal

protected final java.math.BigDecimal getCellYBigDecimal(long cellRowIndex)
Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a BigDecimal.

Parameters:
cellRowIndex - the cell column index thats centroid y-coordinate is returned.

getCellYDouble

public final double getCellYDouble(long cellRowIndex,
                                   boolean handleOutOfMemoryError)
Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a double.

Parameters:
cellRowIndex - the cell column index thats centroid y-coordinate is returned.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellYDouble

protected final double getCellYDouble(long cellRowIndex)
Returns the y-coordinate of the centroid for cells with row index cellRowIndex as a double.

Parameters:
cellRowIndex - the cell column index thats centroid y-coordinate is returned.

getCellYBigDecimal

public final java.math.BigDecimal getCellYBigDecimal(Grid2DSquareCellAbstract.CellID cellID,
                                                     boolean handleOutOfMemoryError)
Returns the y-coordinate of the centroid of cell with CellID cellID as a BigDecimal.

Parameters:
cellID -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellYBigDecimal

protected final java.math.BigDecimal getCellYBigDecimal(Grid2DSquareCellAbstract.CellID cellID)
Returns the y-coordinate of the centroid of cell with CellID cellID as a BigDecimal.

Parameters:
cellID -

getCellYDouble

public final double getCellYDouble(Grid2DSquareCellAbstract.CellID cellID,
                                   boolean handleOutOfMemoryError)
Returns the y-coordinate of the centroid of cell with CellID cellID as a double.

Parameters:
cellID -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellYDouble

protected final double getCellYDouble(Grid2DSquareCellAbstract.CellID cellID)
Returns the y-coordinate of the centroid of cell with CellID cellID as a double.

Parameters:
cellID -

getGridBounds

public final double[] getGridBounds(boolean handleOutOfMemoryError)
Returns gridBounds (the bounding box of the grid) as a double[] where; gridBounds[0] xmin, left most x-coordinate of this gridBounds[1] ymin, lowest y-coordinate of this gridBounds[2] xmax, right most x-coordinate of this gridBounds[3] ymax, highest y-coordinate of this

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: Are bounds in double range? Is there more than cellsize difference with precision? Throw appropriate exceptions.

getGridBounds

protected final double[] getGridBounds()
Returns gridBounds (the bounding box of the grid) as a double[] where; gridBounds[0] xmin, left most x-coordinate of this gridBounds[1] ymin, lowest y-coordinate of this gridBounds[2] xmax, right most x-coordinate of this gridBounds[3] ymax, highest y-coordinate of this TODO: Are bounds in double range? Is there more than cellsize difference with precision? Throw appropriate exceptions.


getCellBoundsDoubleArray

public final double[] getCellBoundsDoubleArray(long cellRowIndex,
                                               long cellColIndex,
                                               boolean handleOutOfMemoryError)
Returns double[] where; double[0] xmin, left most x-coordinate of cell at (rowIndex,colIndex) double[1] ymin, lowest y-coordinate of cell at (rowIndex,colIndex) double[2] xmax, right most x-coordinate of cell at (rowIndex,colIndex) double[3] ymax, highest y-coordinate of cell at (rowIndex,colIndex)

Parameters:
cellRowIndex - the row index of the cell for which the bounds are returned
cellColIndex - the column index of the cell for which the bounds are returned
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getCellBoundsDoubleArray

protected final double[] getCellBoundsDoubleArray(long cellRowIndex,
                                                  long cellColIndex)
Returns double[] where; double[0] xmin, left most x-coordinate of cell at (rowIndex,colIndex) double[1] ymin, lowest y-coordinate of cell at (rowIndex,colIndex) double[2] xmax, right most x-coordinate of cell at (rowIndex,colIndex) double[3] ymax, highest y-coordinate of cell at (rowIndex,colIndex)

Parameters:
cellRowIndex - the row index of the cell for which the bounds are returned
cellColIndex - the column index of the cell for which the bounds are returned

getCellBoundsDoubleArray

public final double[] getCellBoundsDoubleArray(double x,
                                               double y,
                                               boolean handleOutOfMemoryError)
Returns double[] where; double[0] xmin, left most x-coordinate of cell that intersects point at (x,y) double[1] ymin, lowest y-coordinate of cell that intersects point at (x,y) double[2] xmax, right most x-coordinate of cell that intersects point at (x,y) double[3] ymax, highest y-coordinate of cell that intersects point at (x,y)

Parameters:
x - the x-coordinate in the cell for which the bounds are returned
y - the y-coordinate in the cell for which the bounds are returned
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: Precision may compromise result. More precision is available via BigDecimal arithmetic.

getCellBoundsDoubleArray

protected final double[] getCellBoundsDoubleArray(double x,
                                                  double y)
Returns double[] where; double[0] xmin, left most x-coordinate of cell that intersects point at (x,y) double[1] ymin, lowest y-coordinate of cell that intersects point at (x,y) double[2] xmax, right most x-coordinate of cell that intersects point at (x,y) double[3] ymax, highest y-coordinate of cell that intersects point at (x,y)

Parameters:
x - the x-coordinate in the cell for which the bounds are returned
y - the y-coordinate in the cell for which the bounds are returned TODO: Precision may compromise result. More precision is available via BigDecimal arithmetic.

getNoDataValueBigDecimal

public abstract java.math.BigDecimal getNoDataValueBigDecimal(boolean handleOutOfMemoryError)
Returns the noDataValue of this as a BigDecimal.


getNextChunk

public Grid2DSquareCellAbstract.ChunkID getNextChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                     int nChunkRows,
                                                     int nChunkCols,
                                                     boolean handleOutOfMemoryError)
Returns the next ChunkID in row major order from chunkID, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?

getNextChunk

protected Grid2DSquareCellAbstract.ChunkID getNextChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                        int nChunkRows,
                                                        int nChunkCols)
Returns the next ChunkID in row major order from chunkID, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols - TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?

getNextChunkRowMinor

public Grid2DSquareCellAbstract.ChunkID getNextChunkRowMinor(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                             int nChunkRows,
                                                             int nChunkCols,
                                                             boolean handleOutOfMemoryError)
Returns the next ChunkID in row minor order from this, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?

getNextChunkRowMinor

protected Grid2DSquareCellAbstract.ChunkID getNextChunkRowMinor(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                                int nChunkRows,
                                                                int nChunkCols)
Returns the next ChunkID in row minor order from this, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols - TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?

getPreviousChunk

public Grid2DSquareCellAbstract.ChunkID getPreviousChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                         int nChunkRows,
                                                         int nChunkCols,
                                                         boolean handleOutOfMemoryError)
Returns the next ChunkID in row major order from this, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown. TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?

getPreviousChunk

protected Grid2DSquareCellAbstract.ChunkID getPreviousChunk(Grid2DSquareCellAbstract.ChunkID chunkID,
                                                            int nChunkRows,
                                                            int nChunkCols)
Returns the next ChunkID in row major order from this, or null.

Parameters:
chunkID -
nChunkRows -
nChunkCols - TODO: Is it inefficient to pass in nChunkRows and nChunkCols since this has them already?