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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract
      extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellIntChunkAbstract
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Grid2DSquareCellIntChunk64CellMap, Grid2DSquareCellIntChunkArray, Grid2DSquareCellIntChunkJAI, Grid2DSquareCellIntChunkMap, Grid2DSquareCellIntChunkRAF

public abstract class Grid2DSquareCellIntChunkAbstract
extends Grid2DSquareCellChunkAbstract
implements java.io.Serializable

TODO: docs

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract
Grid2DSquareCellChunkAbstract.ChunkCellID
 
Field Summary
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract
chunkID, grid2DSquareCell
 
Constructor Summary
Grid2DSquareCellIntChunkAbstract()
           
 
Method Summary
abstract  void clearData()
          For clearing the data associated with this.
 double getArithmeticMeanDouble()
          For returning the Arithmetic Mean of all non noDataValues as a double.
abstract  int getCell(int chunkCellRowIndex, int chunkCellColIndex, int noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell col chunkCellColIndex as a int.
 double getCellDouble(int chunkCellRowIndex, int chunkCellColIndex, int noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell col chunkCellColIndex as a double.
 Grid2DSquareCellInt getGrid2DSquareCellInt()
          Returns grid2DSquareCellInt.
 int getMaxInt()
          For returning the maximum of all non noDataValues as a double
 double getMedianDouble()
          For returning the median of all non noDataValues as a double.
 int getMinInt()
          For returning the minimum of all non noDataValues as a int
 gnu.trove.TIntHashSet getModeTIntHashSet()
          For returning the mode of all non noDataValues as a TDoubleHashSet.
 java.math.BigInteger getNonNoDataValueCountBigInteger()
          For returning the number of cells with noDataValues as a BigInteger
 int getNonNoDataValueCountInt()
          Returns the number of cells with noDataValues as an int
 double getStandardDeviationDouble()
          For returning the standard deviation of all non noDataValues as a double
 java.math.BigDecimal getSumBigDecimal()
          For returning the sum of all non noDataValues as a BigDecimal
protected abstract  void initCell(int chunkCellRowIndex, int chunkCellColIndex, int valueToInitialise)
          Initialises the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex.
protected  void initCells(Grid2DSquareCellIntChunkRAF grid2DSquareCellIntChunkRAF)
          Initialises the value of this with those in the randomAccessFiles.
abstract  void initData()
          For initialising the data associated with this.
abstract  int setCell(int chunkCellRowIndex, int chunkCellColIndex, int valueToSet, int noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex and sets it to valueToSet
protected  void sort1(int[] x, int off, int len)
          Sorts the specified sub-array of doubles into ascending order.
 int[] toArrayIncludingNoDataValues()
          TODO: docs
 int[] toArrayNotIncludingNoDataValues()
          TODO: docs
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract
getChunkID, getGrid2DSquareCell, getName, inChunk, initChunkID, initGrid2DSquareCell, iterator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grid2DSquareCellIntChunkAbstract

public Grid2DSquareCellIntChunkAbstract()
Method Detail

getGrid2DSquareCellInt

public Grid2DSquareCellInt getGrid2DSquareCellInt()
Returns grid2DSquareCellInt.


getCell

public abstract int getCell(int chunkCellRowIndex,
                            int chunkCellColIndex,
                            int noDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell col chunkCellColIndex as a int.

Parameters:
chunkCellRowIndex - the row index of the cell w.r.t. the origin of this chunk
chunkCellColIndex - the column index of the cell w.r.t. the origin of this chunk
noDataValue - the noDataValue of this.grid2DSquareCellInt

getCellDouble

public double getCellDouble(int chunkCellRowIndex,
                            int chunkCellColIndex,
                            int noDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell col chunkCellColIndex as a double.

Parameters:
chunkCellRowIndex - the row index of the cell w.r.t. the origin of this chunk
chunkCellColIndex - the column index of the cell w.r.t. the origin of this chunk
noDataValue - the noDataValue of this.grid2DSquareCellInt TODO: Ensure the int can be represented exactly as a double. If not throw Exception of some kind.

initCell

protected abstract void initCell(int chunkCellRowIndex,
                                 int chunkCellColIndex,
                                 int valueToInitialise)
Initialises the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex. Utility method for constructors of extending classes.

Parameters:
chunkCellRowIndex - the row index of the cell w.r.t. the origin of this chunk
chunkCellColIndex - the column index of the cell w.r.t. the origin of this chunk
valueToInitialise - the value with which the cell is initialised

initCells

protected void initCells(Grid2DSquareCellIntChunkRAF grid2DSquareCellIntChunkRAF)
Initialises the value of this with those in the randomAccessFiles. The initialisation is done in row order and ifthe end of the file is reached then the remaining values are assumed to be noDataValues. NB1. This method is intended mainly for use in caching


setCell

public abstract int setCell(int chunkCellRowIndex,
                            int chunkCellColIndex,
                            int valueToSet,
                            int noDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex and sets it to valueToSet

Parameters:
chunkCellRowIndex - the row index of the cell w.r.t. the origin of this chunk
chunkCellColIndex - the column index of the cell w.r.t. the origin of this chunk
valueToSet - the value the cell is to be set to
noDataValue - the noDataValue of this.grid2DSquareCellDouble

clearData

public abstract void clearData()
For clearing the data associated with this.

Specified by:
clearData in class Grid2DSquareCellChunkAbstract

initData

public abstract void initData()
For initialising the data associated with this.

Specified by:
initData in class Grid2DSquareCellChunkAbstract

toArrayIncludingNoDataValues

public int[] toArrayIncludingNoDataValues()
TODO: docs


toArrayNotIncludingNoDataValues

public int[] toArrayNotIncludingNoDataValues()
TODO: docs


getNonNoDataValueCountBigInteger

public java.math.BigInteger getNonNoDataValueCountBigInteger()
For returning the number of cells with noDataValues as a BigInteger


getNonNoDataValueCountInt

public int getNonNoDataValueCountInt()
Returns the number of cells with noDataValues as an int


getSumBigDecimal

public java.math.BigDecimal getSumBigDecimal()
For returning the sum of all non noDataValues as a BigDecimal


getMinInt

public int getMinInt()
For returning the minimum of all non noDataValues as a int


getMaxInt

public int getMaxInt()
For returning the maximum of all non noDataValues as a double


getArithmeticMeanDouble

public double getArithmeticMeanDouble()
For returning the Arithmetic Mean of all non noDataValues as a double. Using BigDecimal this should be as precise as possible with doubles.


getModeTIntHashSet

public gnu.trove.TIntHashSet getModeTIntHashSet()
For returning the mode of all non noDataValues as a TDoubleHashSet. TODO: Better to use toArray and go through a sorted version?


getMedianDouble

public double getMedianDouble()
For returning the median of all non noDataValues as a double. This method requires that all data in chunk can be stored as a new array.


sort1

protected void sort1(int[] x,
                     int off,
                     int len)
Sorts the specified sub-array of doubles into ascending order. Source copied from java.util.Arrays and method changed so not static for performance reasons.


getStandardDeviationDouble

public double getStandardDeviationDouble()
For returning the standard deviation of all non noDataValues as a double