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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellAbstractFactory
Direct Known Subclasses:
Grid2DSquareCellDoubleFactory, Grid2DSquareCellIntFactory

public abstract class Grid2DSquareCellAbstractFactory
extends java.lang.Object

Abstract class to be extended by all Grid2DSquareCellAbstract factories.


Field Summary
protected  int chunkNcols
          The number of columns in a chunk.
protected  int chunkNrows
          The number of rows in a chunk.
protected  java.math.BigDecimal[] dimensions
          The Dimensions
protected  java.io.File directory
          A directory for swapping.
protected  java.util.HashSet grid2DSquareCells
          A container of other Grid2DSquareCellAbstract references.
protected  GridStatisticsAbstract gridStatistics
          The GridStatisticsAbstract
protected  boolean handleOutOfMemoryError
          handleOutOfMemoryError
 
Constructor Summary
Grid2DSquareCellAbstractFactory()
           
 
Method Summary
 Grid2DSquareCellAbstract create()
          Returns an Grid2DSquareCellAbstract loaded from this.directory.
 Grid2DSquareCellAbstract create(java.io.File gridFile)
          Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.
 Grid2DSquareCellAbstract create(java.io.File directory, java.io.File gridFile, long startRowIndex, long startColIndex, long endRowIndex, long endColIndex)
          Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.
abstract  Grid2DSquareCellAbstract create(java.io.File directory, java.io.File gridFile, long startRowIndex, long startColIndex, long endRowIndex, long endColIndex, java.util.HashSet grid2DSquareCells, boolean handleOutOfMemoryError)
          Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.
 Grid2DSquareCellAbstract create(java.io.File directory, java.io.File gridFile, java.io.ObjectInputStream ois)
          Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.
abstract  Grid2DSquareCellAbstract create(java.io.File directory, java.io.File gridFile, java.io.ObjectInputStream ois, java.util.HashSet grid2DSquareCells, boolean handleOutOfMemoryError)
          Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.
 Grid2DSquareCellAbstract create(java.io.File directory, Grid2DSquareCellAbstract grid2DSquareCell, long startRowIndex, long startColIndex, long endRowIndex, long endColIndex)
          Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.
abstract  Grid2DSquareCellAbstract create(java.io.File directory, Grid2DSquareCellAbstract grid2DSquareCell, long startRowIndex, long startColIndex, long endRowIndex, long endColIndex, java.util.HashSet grid2DSquareCells, boolean handleOutOfMemoryError)
          Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.
 Grid2DSquareCellAbstract create(java.io.File directory, long nrows, long ncols, java.math.BigDecimal[] dimensions)
          Returns an Grid2DSquareCellAbstract with all values as noDataValues.
abstract  Grid2DSquareCellAbstract create(java.io.File directory, long nrows, long ncols, java.math.BigDecimal[] dimensions, java.util.HashSet grid2DSquareCells, boolean handleOutOfMemoryError)
          Returns a new Grid2DSquareCellAbstract grid with all values as noDataValues.
 Grid2DSquareCellAbstract create(Grid2DSquareCellAbstract grid2DSquareCell)
          Returns a new Grid2DSquareCellAbstract with all values as int values from grid2DSquareCell.
 Grid2DSquareCellAbstract create(Grid2DSquareCellAbstract grid2DSquareCell, long startRowIndex, long startColIndex, long endRowIndex, long endColIndex)
          Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.
 Grid2DSquareCellAbstract create(long nrows, long ncols)
          Returns an Grid2DSquareCellAbstract with all values as noDataValues.
 Grid2DSquareCellAbstract create(long nrows, long ncols, java.math.BigDecimal[] dimensions)
          Returns an Grid2DSquareCellAbstract with all values as noDataValues.
 int getChunkNcols()
          Returns a copy of this.chunkNcols.
 int getChunkNrows()
          Returns a copy of this.chunkNrows.
 java.math.BigDecimal[] getDimensions()
          Returns this.dimensions
 java.io.File getDirectory()
          Returns a copy of this.directory.
 java.util.HashSet getGrid2DSquareCells()
          Returns this.grid2DSquareCells
 GridStatisticsAbstract getGridStatistics()
          Returns this.gridStatistics
 boolean getHandleOutOfMemoryError()
          Returns this.handleOutOfMemoryError
 void setChunkNcols(int chunkNcols)
          Sets this.chunkNcols to chunkNcols
 void setChunkNrows(int chunkNrows)
          Sets this.chunkNrows to chunkNrows
 void setDimensions(java.math.BigDecimal[] dimensions)
          Sets this.dimensions to dimensions
 void setDirectory(java.io.File directory)
          Sets this.directory to directory.
 void setGrid2DSquareCells(java.util.HashSet grid2DSquareCells)
          Sets this.grid2DSquareCells to grid2DSquareCells
 void setGridStatistics(GridStatisticsAbstract gridStatistics)
          Sets this.gridStatistics to gridStatistics
 void setHandleOutOfMemoryError(boolean handleOutOfMemoryError)
          Sets this.handleOutOfMemoryError to handleOutOfMemoryError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directory

protected java.io.File directory
A directory for swapping.


chunkNrows

protected int chunkNrows
The number of rows in a chunk.


chunkNcols

protected int chunkNcols
The number of columns in a chunk.


dimensions

protected java.math.BigDecimal[] dimensions
The Dimensions


grid2DSquareCells

protected java.util.HashSet grid2DSquareCells
A container of other Grid2DSquareCellAbstract references.


gridStatistics

protected GridStatisticsAbstract gridStatistics
The GridStatisticsAbstract


handleOutOfMemoryError

protected boolean handleOutOfMemoryError
handleOutOfMemoryError

Constructor Detail

Grid2DSquareCellAbstractFactory

public Grid2DSquareCellAbstractFactory()
Method Detail

getDirectory

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


setDirectory

public void setDirectory(java.io.File directory)
Sets this.directory to directory.


getChunkNrows

public int getChunkNrows()
Returns a copy of this.chunkNrows.


setChunkNrows

public void setChunkNrows(int chunkNrows)
Sets this.chunkNrows to chunkNrows


getChunkNcols

public int getChunkNcols()
Returns a copy of this.chunkNcols.


setChunkNcols

public void setChunkNcols(int chunkNcols)
Sets this.chunkNcols to chunkNcols


getDimensions

public java.math.BigDecimal[] getDimensions()
Returns this.dimensions


setDimensions

public void setDimensions(java.math.BigDecimal[] dimensions)
Sets this.dimensions to dimensions


getGrid2DSquareCells

public java.util.HashSet getGrid2DSquareCells()
Returns this.grid2DSquareCells


setGrid2DSquareCells

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


getGridStatistics

public GridStatisticsAbstract getGridStatistics()
Returns this.gridStatistics


setGridStatistics

public void setGridStatistics(GridStatisticsAbstract gridStatistics)
Sets this.gridStatistics to gridStatistics


getHandleOutOfMemoryError

public boolean getHandleOutOfMemoryError()
Returns this.handleOutOfMemoryError


setHandleOutOfMemoryError

public void setHandleOutOfMemoryError(boolean handleOutOfMemoryError)
Sets this.handleOutOfMemoryError to handleOutOfMemoryError


create

public Grid2DSquareCellAbstract create()
Returns an Grid2DSquareCellAbstract loaded from this.directory.


create

public Grid2DSquareCellAbstract create(long nrows,
                                       long ncols)
Returns an Grid2DSquareCellAbstract with all values as noDataValues.

Parameters:
nrows - The nrows for the construct.
ncols - The ncols for the construct.

create

public Grid2DSquareCellAbstract create(long nrows,
                                       long ncols,
                                       java.math.BigDecimal[] dimensions)
Returns an Grid2DSquareCellAbstract with all values as noDataValues.

Parameters:
nrows - The nrows for the construct.
ncols - The ncols for the construct.
dimensions - The cellsize and bounding box details for the construct.

create

public Grid2DSquareCellAbstract create(java.io.File directory,
                                       long nrows,
                                       long ncols,
                                       java.math.BigDecimal[] dimensions)
Returns an Grid2DSquareCellAbstract with all values as noDataValues.

Parameters:
directory - The directory for swapping to file.
nrows - The nrows for the construct.
ncols - The ncols for the construct.
dimensions - The cellsize and bounding box details for the construct.

create

public abstract Grid2DSquareCellAbstract create(java.io.File directory,
                                                long nrows,
                                                long ncols,
                                                java.math.BigDecimal[] dimensions,
                                                java.util.HashSet grid2DSquareCells,
                                                boolean handleOutOfMemoryError)
Returns a new Grid2DSquareCellAbstract grid with all values as noDataValues.

Parameters:
directory - The directory for swapping to file.
nrows - The nrows for the construct.
ncols - The ncols for the construct.
grid2DSquareCells - A HashSet of swappable Grid2DSquareCellAbstract instances.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught in this method then swap operations are initiated prior to retrying. If false then OutOfMemoryErrors are caught and thrown.

create

public Grid2DSquareCellAbstract create(Grid2DSquareCellAbstract grid2DSquareCell)
Returns a new Grid2DSquareCellAbstract with all values as int values from grid2DSquareCell.

Parameters:
grid2DSquareCell - The Grid2DSquareCellAbstract from which values are obtained.

create

public Grid2DSquareCellAbstract create(Grid2DSquareCellAbstract grid2DSquareCell,
                                       long startRowIndex,
                                       long startColIndex,
                                       long endRowIndex,
                                       long endColIndex)
Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.

Parameters:
grid2DSquareCell - The Grid2DSquareCellAbstract from which values are obtained.
startRowIndex - The topmost row index of grid2DSquareCell thats values are used.
startColIndex - The leftmost column index of grid2DSquareCell thats values are used.
endRowIndex - The bottom row index of the grid2DSquareCell thats values are used.
endColIndex - The rightmost column index of grid2DSquareCell thats values are used.

create

public Grid2DSquareCellAbstract create(java.io.File directory,
                                       Grid2DSquareCellAbstract grid2DSquareCell,
                                       long startRowIndex,
                                       long startColIndex,
                                       long endRowIndex,
                                       long endColIndex)
Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.

Parameters:
directory - The directory to be used for storing data in files. Grid2DSquareCellInt information.
grid2DSquareCell - The Grid2DSquareCellAbstract from which values are obtained.
startRowIndex - The topmost row index of grid2DSquareCell thats values are used.
startColIndex - The leftmost column index of grid2DSquareCell thats values are used.
endRowIndex - The bottom row index of the grid2DSquareCell thats values are used.
endColIndex - The rightmost column index of grid2DSquareCell thats values are used.

create

public abstract Grid2DSquareCellAbstract create(java.io.File directory,
                                                Grid2DSquareCellAbstract grid2DSquareCell,
                                                long startRowIndex,
                                                long startColIndex,
                                                long endRowIndex,
                                                long endColIndex,
                                                java.util.HashSet grid2DSquareCells,
                                                boolean handleOutOfMemoryError)
Returns a new Grid2DSquareCellAbstract with values obtained from grid2DSquareCell.

Parameters:
directory - The directory to be used for storing data in files.
grid2DSquareCell - The Grid2DSquareCellAbstract from which values are obtained.
startRowIndex - The topmost row index of grid2DSquareCell thats values are used.
startColIndex - The leftmost column index of grid2DSquareCell thats values are used.
endRowIndex - The bottom row index of the grid2DSquareCell thats values are used.
endColIndex - The rightmost column index of grid2DSquareCell thats values are used.
grid2DSquareCells - A HashSet of swappable Grid2DSquareCellAbstract instances.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught in this method then swap operations are initiated prior to retrying. If false then OutOfMemoryErrors are caught and thrown.

create

public Grid2DSquareCellAbstract create(java.io.File gridFile)
Returns a new Grid2DSquareCellAbstract with values obtained from gridFile. If gridFile is a directory then it is assumed to contain a file called cache which can be opened into an object input stream and initailised as an instance of a class extending Grid2DSquareCellAbstract.

Parameters:
gridFile - either a directory, or a formatted File with a specific extension containing the data and information about the Grid2DSquareCellAbstract to be returned.

create

public Grid2DSquareCellAbstract create(java.io.File directory,
                                       java.io.File gridFile,
                                       long startRowIndex,
                                       long startColIndex,
                                       long endRowIndex,
                                       long endColIndex)
Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.

Parameters:
directory - The directory to be used for storing cached Grid2DSquareCellInt information.
gridFile - either a directory, or a formatted File with a specific extension containing the data and information about the Grid2DSquareCellAbstract to be returned.
startRowIndex - The topmost row index of the grid represented in gridFile thats values are used.
startColIndex - The leftmost column index of the grid represented in gridFile thats values are used.
endRowIndex - The bottom row index of the grid represented in gridFile thats values are used.
endColIndex - The rightmost column index of the grid represented in gridFile thats values are used. Default: grid2DSquareCells to null; handleOutOfMemoryError to true.

create

public abstract Grid2DSquareCellAbstract create(java.io.File directory,
                                                java.io.File gridFile,
                                                long startRowIndex,
                                                long startColIndex,
                                                long endRowIndex,
                                                long endColIndex,
                                                java.util.HashSet grid2DSquareCells,
                                                boolean handleOutOfMemoryError)
Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.

Parameters:
directory - The directory to be used for storing cached Grid2DSquareCellInt information.
gridFile - either a directory, or a formatted File with a specific extension containing the data and information about the Grid2DSquareCellAbstract to be returned.
startRowIndex - The topmost row index of the grid represented in gridFile thats values are used.
startColIndex - The leftmost column index of the grid represented in gridFile thats values are used.
endRowIndex - The bottom row index of the grid represented in gridFile thats values are used.
endColIndex - The rightmost column index of the grid represented in gridFile thats values are used.
grid2DSquareCells - A HashSet of swappable Grid2DSquareCellAbstract instances.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught in this method then swap operations are initiated prior to retrying. If false then OutOfMemoryErrors are caught and thrown.

create

public Grid2DSquareCellAbstract create(java.io.File directory,
                                       java.io.File gridFile,
                                       java.io.ObjectInputStream ois)
Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.

Parameters:
directory - The directory for swapping to file.
gridFile - A file containing the data to be used in construction.
ois - The ObjectInputStream to construct from.

create

public abstract Grid2DSquareCellAbstract create(java.io.File directory,
                                                java.io.File gridFile,
                                                java.io.ObjectInputStream ois,
                                                java.util.HashSet grid2DSquareCells,
                                                boolean handleOutOfMemoryError)
Returns a new Grid2DSquareCellAbstract with values obtained from gridFile.

Parameters:
directory - The directory for swapping to file.
gridFile - A file containing the data to be used in construction.
ois - The ObjectInputStream to construct from.
grid2DSquareCells - A HashSet of swappable Grid2DSquareCellAbstract instances.
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught in this method then swap operations are initiated prior to retrying. If false then OutOfMemoryErrors are caught and thrown.