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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
      extended by uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellDoubleChunk
          extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleChunkMap
All Implemented Interfaces:
java.io.Serializable

public class Grid2DSquareCellDoubleChunkMap
extends AbstractGrid2DSquareCellDoubleChunk
implements java.io.Serializable

AbstractGrid2DSquareCellDoubleChunk extension that stores cell values in a TDoubleObjectHashMap.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
AbstractGrid2DSquareCellChunk.ChunkCellID
 
Field Summary
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
_ChunkID, _Grid2DSquareCell, isSwapUpToDate
 
Constructor Summary
  Grid2DSquareCellDoubleChunkMap()
          Default constructor.
protected Grid2DSquareCellDoubleChunkMap(AbstractGrid2DSquareCellDoubleChunk grid2DSquareCellDoubleChunk, AbstractGrid2DSquareCell.ChunkID _ChunkID, double defaultValue)
          Creates a new Grid2DSquareCellDoubleChunkMap
protected Grid2DSquareCellDoubleChunkMap(Grid2DSquareCellDouble grid2DSquareCellDouble, AbstractGrid2DSquareCell.ChunkID _ChunkID)
          Creates a new Grid2DSquareCellDoubleChunkMap
protected Grid2DSquareCellDoubleChunkMap(Grid2DSquareCellDouble grid2DSquareCellDouble, AbstractGrid2DSquareCell.ChunkID _ChunkID, double defaultValue)
          Creates a new Grid2DSquareCellDoubleChunkMap
 
Method Summary
protected  void clearData()
          Clears the data associated with this.
protected  double getArithmeticMeanDouble()
          Returns the Arithmetic Mean of all non _NoDataValues as a double.
protected  double getCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, double _NoDataValue)
          Returns the value of cell with CellID given by chunkCellID.
protected  double getCell(int chunkCellRowIndex, int chunkCellColIndex, double _NoDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex.
protected  gnu.trove.TDoubleObjectHashMap getData()
          Returns this.data TODO: This could be made public if a copy is returned!
protected  java.math.BigInteger getDiversityBigInteger()
          For returning the number of different values.
protected  double getMaxDouble()
          Returns the maximum of all non _NoDataValues as a double
protected  double getMedianDouble()
          For returning the median of all non _NoDataValues as a double
protected  double getMinDouble()
          Returns the minimum of all non _NoDataValues as a double.
protected  gnu.trove.TDoubleHashSet getModeTDoubleHashSet()
          For returning the mode of all non _NoDataValues as a TDoubleHashSet
protected  java.math.BigInteger getNonNoDataValueCountBigInteger()
          Returns the number of cells with non _NoDataValues as a BigInteger.
protected  double getStandardDeviationDouble()
          For returning the standard deviation of all non _NoDataValues as a double
protected  java.math.BigDecimal getSumBigDecimal()
          Returns the sum of all non _NoDataValues as a BigDecimal.
protected  void initCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, double valueToInitialise)
          Initialises the value of the chunk referred to by chunkCellID to valueToInitialise.
protected  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 initData()
          Initialises the data associated with this.
protected  AbstractIterator iterator()
          Returns a Grid2DSquareCellDoubleChunkMapIterator for iterating over the cells in this.
protected  double setCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, double valueToSet, double _NoDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet
protected  double setCell(int chunkCellRowIndex, int chunkCellColIndex, double valueToSet, double _NoDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet
protected  double[] toArrayIncludingNoDataValues()
          Returns values in row major order as a double[].
protected  double[] toArrayNotIncludingNoDataValues()
          Returns non _NoDataValue in row major order as a double[].
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellDoubleChunk
getArithmeticMeanBigDecimal, getArithmeticMeanBigDecimal, getArithmeticMeanDouble, getCell, getCell, getCellBigDecimal, getGrid2DSquareCellDouble, getGrid2DSquareCellDouble, getMaxDouble, getMedianDouble, getMinDouble, getModeTDoubleHashSet, getNonNoDataValueCountBigInteger, getNonNoDataValueCountInt, getNonNoDataValueCountInt, getStandardDeviationDouble, getSumBigDecimal, initCell, initCells, initCells, setCell, sort1, toArrayIncludingNoDataValues, toArrayNotIncludingNoDataValues
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
getChunkID, getChunkID, getDescription, getGrid2DSquareCell, getGrid2DSquareCell, getIsSwapUpToDate, getIsSwapUpToDate, getName, getName, inChunk, inChunk, initChunkID, initGrid2DSquareCell, iterator, setIsSwapUpToDate, setIsSwapUpToDate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grid2DSquareCellDoubleChunkMap

public Grid2DSquareCellDoubleChunkMap()
Default constructor.


Grid2DSquareCellDoubleChunkMap

protected Grid2DSquareCellDoubleChunkMap(Grid2DSquareCellDouble grid2DSquareCellDouble,
                                         AbstractGrid2DSquareCell.ChunkID _ChunkID)
Creates a new Grid2DSquareCellDoubleChunkMap

Parameters:
grid2DSquareCellDouble -
_ChunkID - Default: default value to grid2DSquareCellDouble.getNoDataValue()

Grid2DSquareCellDoubleChunkMap

protected Grid2DSquareCellDoubleChunkMap(Grid2DSquareCellDouble grid2DSquareCellDouble,
                                         AbstractGrid2DSquareCell.ChunkID _ChunkID,
                                         double defaultValue)
Creates a new Grid2DSquareCellDoubleChunkMap

Parameters:
grid2DSquareCellDouble -
_ChunkID -
defaultValue -

Grid2DSquareCellDoubleChunkMap

protected Grid2DSquareCellDoubleChunkMap(AbstractGrid2DSquareCellDoubleChunk grid2DSquareCellDoubleChunk,
                                         AbstractGrid2DSquareCell.ChunkID _ChunkID,
                                         double defaultValue)
Creates a new Grid2DSquareCellDoubleChunkMap

Parameters:
grid2DSquareCellDoubleChunk -
_ChunkID - Default: default value to grid2DSquareCellDouble.getNoDataValue() TODO: Optimise for different types.
Method Detail

initData

protected void initData()
Initialises the data associated with this.

Specified by:
initData in class AbstractGrid2DSquareCellDoubleChunk

getData

protected gnu.trove.TDoubleObjectHashMap getData()
Returns this.data TODO: This could be made public if a copy is returned!


clearData

protected void clearData()
Clears the data associated with this.

Specified by:
clearData in class AbstractGrid2DSquareCellDoubleChunk

toArrayIncludingNoDataValues

protected double[] toArrayIncludingNoDataValues()
Returns values in row major order as a double[].

Overrides:
toArrayIncludingNoDataValues in class AbstractGrid2DSquareCellDoubleChunk

toArrayNotIncludingNoDataValues

protected double[] toArrayNotIncludingNoDataValues()
Returns non _NoDataValue in row major order as a double[].

Overrides:
toArrayNotIncludingNoDataValues in class AbstractGrid2DSquareCellDoubleChunk

getCell

protected double getCell(int chunkCellRowIndex,
                         int chunkCellColIndex,
                         double _NoDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex.

Specified by:
getCell in class AbstractGrid2DSquareCellDoubleChunk
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

getCell

protected double getCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID,
                         double _NoDataValue)
Returns the value of cell with CellID given by chunkCellID.

Parameters:
chunkCellID - The chunk CellID of cell thats value is returned.
_NoDataValue - The _NoDataValue of this.grid2DSquareCellDouble.

initCell

protected 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 constructor.

Specified by:
initCell in class AbstractGrid2DSquareCellDoubleChunk
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

initCell

protected void initCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID,
                        double valueToInitialise)
Initialises the value of the chunk referred to by chunkCellID to valueToInitialise. Utility method for constructor.

Parameters:
chunkCellID - the AbstractGrid2DSquareCellDoubleChunk.ChunkCellID of the cell to be initialised
valueToInitialise - the value with which the cell is initialised

setCell

protected double setCell(int chunkCellRowIndex,
                         int chunkCellColIndex,
                         double valueToSet,
                         double _NoDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet

Specified by:
setCell in class AbstractGrid2DSquareCellDoubleChunk
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

setCell

protected double setCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID,
                         double valueToSet,
                         double _NoDataValue)
Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet

Parameters:
chunkCellID - the AbstractGrid2DSquareCellDoubleChunk.ChunkCellID of the cell to be initialised
valueToSet - the value the cell is to be set to
_NoDataValue - the _NoDataValue of this.grid2DSquareCellDouble

getNonNoDataValueCountBigInteger

protected java.math.BigInteger getNonNoDataValueCountBigInteger()
Returns the number of cells with non _NoDataValues as a BigInteger.

Overrides:
getNonNoDataValueCountBigInteger in class AbstractGrid2DSquareCellDoubleChunk

getSumBigDecimal

protected java.math.BigDecimal getSumBigDecimal()
Returns the sum of all non _NoDataValues as a BigDecimal.

Overrides:
getSumBigDecimal in class AbstractGrid2DSquareCellDoubleChunk

getMinDouble

protected double getMinDouble()
Returns the minimum of all non _NoDataValues as a double.

Overrides:
getMinDouble in class AbstractGrid2DSquareCellDoubleChunk

getMaxDouble

protected double getMaxDouble()
Returns the maximum of all non _NoDataValues as a double

Overrides:
getMaxDouble in class AbstractGrid2DSquareCellDoubleChunk

getArithmeticMeanDouble

protected double getArithmeticMeanDouble()
Returns the Arithmetic Mean of all non _NoDataValues as a double. Using BigDecimal this should be as precise as possible with doubles.

Overrides:
getArithmeticMeanDouble in class AbstractGrid2DSquareCellDoubleChunk

getModeTDoubleHashSet

protected gnu.trove.TDoubleHashSet getModeTDoubleHashSet()
For returning the mode of all non _NoDataValues as a TDoubleHashSet

Overrides:
getModeTDoubleHashSet in class AbstractGrid2DSquareCellDoubleChunk

getMedianDouble

protected double getMedianDouble()
For returning the median of all non _NoDataValues as a double

Overrides:
getMedianDouble in class AbstractGrid2DSquareCellDoubleChunk

getStandardDeviationDouble

protected double getStandardDeviationDouble()
For returning the standard deviation of all non _NoDataValues as a double

Overrides:
getStandardDeviationDouble in class AbstractGrid2DSquareCellDoubleChunk

getDiversityBigInteger

protected java.math.BigInteger getDiversityBigInteger()
For returning the number of different values.


iterator

protected AbstractIterator iterator()
Returns a Grid2DSquareCellDoubleChunkMapIterator for iterating over the cells in this.

Specified by:
iterator in class AbstractGrid2DSquareCellChunk