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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract
      extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleChunkAbstract
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Grid2DSquareCellDoubleChunk64CellMap, Grid2DSquareCellDoubleChunkArray, Grid2DSquareCellDoubleChunkJAI, Grid2DSquareCellDoubleChunkMap, Grid2DSquareCellDoubleChunkRAF

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

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
Grid2DSquareCellDoubleChunkAbstract()
           
 
Method Summary
abstract  void clearData()
          For clearing the data associated with this.
 java.math.BigDecimal getArithmeticMeanBigDecimal(int numberOfDecimalPlaces)
          For returning the Arithmetic Mean of all non noDataValues as a BigDecimal.
 double getArithmeticMeanDouble()
          For returning the Arithmetic Mean of all non noDataValues as a double.
abstract  double getCell(int chunkCellRowIndex, int chunkCellColIndex, double noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex, as a double.
 java.math.BigDecimal getCellBigDecimal(int chunkCellRowIndex, int chunkCellColIndex, double noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex, as a BigDecimal.
 Grid2DSquareCellDouble getGrid2DSquareCellDouble()
          Returns grid2DSquareCellDouble.
 double getMaxDouble()
          For returning the maximum of all non noDataValues as a double
 double getMedianDouble()
          For returning the median of all non noDataValues as a double.
 double getMinDouble()
          For returning the minimum of all non noDataValues as a double
 gnu.trove.TDoubleHashSet getModeTDoubleHashSet()
          For returning the mode of all non noDataValues as a TDoubleHashSet.
 java.math.BigInteger getNonNoDataValueCountBigInteger()
          Returns 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, double valueToInitialise)
          Initialises the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex.
protected  void initCells(Grid2DSquareCellDoubleChunkRAF grid2DSquareCellDoubleChunkRAF)
          Initialises the value of this with those in the randomAccessFiles.
abstract  void initData()
          For initialising the data associated with this.
abstract  double setCell(int chunkCellRowIndex, int chunkCellColIndex, double valueToSet, double noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex and sets it to valueToSet
protected  void sort1(double[] x, int off, int len)
          Sorts the specified sub-array of doubles into ascending order.
 double[] toArrayIncludingNoDataValues()
          TODO: docs
 double[] 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

Grid2DSquareCellDoubleChunkAbstract

public Grid2DSquareCellDoubleChunkAbstract()
Method Detail

getGrid2DSquareCellDouble

public Grid2DSquareCellDouble getGrid2DSquareCellDouble()
Returns grid2DSquareCellDouble.


getCell

public abstract double getCell(int chunkCellRowIndex,
                               int chunkCellColIndex,
                               double noDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row 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.grid2DSquareCellDouble

getCellBigDecimal

public java.math.BigDecimal getCellBigDecimal(int chunkCellRowIndex,
                                              int chunkCellColIndex,
                                              double noDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex, as a BigDecimal. If the value is this.noDataValue then null is returned!

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.grid2DSquareCellDouble.

initCell

protected abstract void initCell(int chunkCellRowIndex,
                                 int chunkCellColIndex,
                                 double 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(Grid2DSquareCellDoubleChunkRAF grid2DSquareCellDoubleChunkRAF)
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 double setCell(int chunkCellRowIndex,
                               int chunkCellColIndex,
                               double valueToSet,
                               double 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 double[] toArrayIncludingNoDataValues()
TODO: docs


toArrayNotIncludingNoDataValues

public double[] toArrayNotIncludingNoDataValues()
TODO: docs


getNonNoDataValueCountBigInteger

public java.math.BigInteger getNonNoDataValueCountBigInteger()
Returns 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


getMinDouble

public double getMinDouble()
For returning the minimum of all non noDataValues as a double


getMaxDouble

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


getArithmeticMeanBigDecimal

public java.math.BigDecimal getArithmeticMeanBigDecimal(int numberOfDecimalPlaces)
For returning the Arithmetic Mean of all non noDataValues as a BigDecimal. If all cells are noDataValues, then null is returned.

Parameters:
numberOfDecimalPlaces - The number of decimal places to which the result is precise.

getArithmeticMeanDouble

public double getArithmeticMeanDouble()
For returning the Arithmetic Mean of all non noDataValues as a double. If all cells are noDataValues, then noDataValue is returned. Using BigDecimal this should be as precise as possible with doubles.


getModeTDoubleHashSet

public gnu.trove.TDoubleHashSet getModeTDoubleHashSet()
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(double[] 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