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

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

public class Grid2DSquareCellIntChunkMap
extends AbstractGrid2DSquareCellIntChunk
implements java.io.Serializable

AbstractGrid2DSquareCellIntChunk extension that stores cell values in a TIntObjectHashMap. TODO: Enable default value to be values other than noDataValue.

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
  Grid2DSquareCellIntChunkMap()
          Default constructor.
protected Grid2DSquareCellIntChunkMap(AbstractGrid2DSquareCellIntChunk grid2DSquareCellIntChunk, AbstractGrid2DSquareCell.ChunkID _ChunkID)
          Creates a new Grid2DSquareCellIntChunkMap
protected Grid2DSquareCellIntChunkMap(AbstractGrid2DSquareCellIntChunk grid2DSquareCellIntChunk, AbstractGrid2DSquareCell.ChunkID _ChunkID, int defaultValue)
          Creates a new Grid2DSquareCellIntChunkMap
protected Grid2DSquareCellIntChunkMap(Grid2DSquareCellInt grid2DSquareCellInt, AbstractGrid2DSquareCell.ChunkID _ChunkID)
          Creates a new Grid2DSquareCellIntChunkMap
protected Grid2DSquareCellIntChunkMap(Grid2DSquareCellInt grid2DSquareCellInt, AbstractGrid2DSquareCell.ChunkID _ChunkID, int defaultValue)
          Creates a new Grid2DSquareCellIntChunkMap
 
Method Summary
 void clearData()
          Clears the data associated with this.
 int getCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, int noDataValue)
          Returns the value of cell with CellID given by chunkCellID
 int getCell(int chunkCellRowIndex, int chunkCellColIndex, int noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell row chunkCellColIndex as a int.
 gnu.trove.TIntObjectHashMap getData()
          Returns this.data.
protected  java.lang.String getDescription()
          Returns a description of this.
 java.math.BigInteger getNonNoDataValueCountBigInteger()
          Returns the number of cells with non noDataValues as a BigInteger.
protected  java.math.BigDecimal getSumBigDecimal()
          Returns the sum of all non noDataValues as a BigDecimal.
protected  void initCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, int valueToInitialise)
          Initialises the value of the chunk referred to by chunkCellID to valueToInitialise.
protected  void initCell(int chunkCellRowIndex, int chunkCellColIndex, int valueToInitialise)
          Initialises the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex.
 void initData()
          Initialises the data associated with this.
protected  AbstractIterator iterator()
          Returns an AbstractIterator for iterating over the cells in this.
 int setCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID, int valueToSet)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet
 int setCell(int chunkCellRowIndex, int chunkCellColIndex, int valueToSet, int noDataValue)
          Returns the value at position given by: chunk cell row chunkCellRowIndex; chunk cell column chunkCellColIndex and sets it to valueToSet
 int[] toArrayIncludingNoDataValues()
          Returns values in row major order as a int[].
 int[] toArrayNotIncludingNoDataValues()
          Returns non noDataValue in row major order as a int[].
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellIntChunk
getArithmeticMeanBigDecimal, getArithmeticMeanBigDecimal, getArithmeticMeanDouble, getArithmeticMeanDouble, getCell, getCellDouble, getGrid2DSquareCellInt, getGrid2DSquareCellInt, getMaxInt, getMaxInt, getMedianDouble, getMedianDouble, getMinInt, getMinInt, getModeTIntHashSet, getModeTIntHashSet, getNonNoDataValueCountBigInteger, getNonNoDataValueCountInt, getNonNoDataValueCountInt, getStandardDeviationDouble, getStandardDeviationDouble, getSumBigDecimal, initCell, initCells, initCells, setCell, sort1, toArrayIncludingNoDataValues, toArrayNotIncludingNoDataValues
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
getChunkID, getChunkID, 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

Grid2DSquareCellIntChunkMap

public Grid2DSquareCellIntChunkMap()
Default constructor.


Grid2DSquareCellIntChunkMap

protected Grid2DSquareCellIntChunkMap(Grid2DSquareCellInt grid2DSquareCellInt,
                                      AbstractGrid2DSquareCell.ChunkID _ChunkID)
Creates a new Grid2DSquareCellIntChunkMap

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

Grid2DSquareCellIntChunkMap

protected Grid2DSquareCellIntChunkMap(Grid2DSquareCellInt grid2DSquareCellInt,
                                      AbstractGrid2DSquareCell.ChunkID _ChunkID,
                                      int defaultValue)
Creates a new Grid2DSquareCellIntChunkMap

Parameters:
grid2DSquareCellInt -
_ChunkID -
defaultValue -

Grid2DSquareCellIntChunkMap

protected Grid2DSquareCellIntChunkMap(AbstractGrid2DSquareCellIntChunk grid2DSquareCellIntChunk,
                                      AbstractGrid2DSquareCell.ChunkID _ChunkID)
Creates a new Grid2DSquareCellIntChunkMap

Parameters:
grid2DSquareCellIntChunk -
_ChunkID - Default: default value to grid2DSquareCellInt.getNoDataValue() TODO: Optimise for different types.

Grid2DSquareCellIntChunkMap

protected Grid2DSquareCellIntChunkMap(AbstractGrid2DSquareCellIntChunk grid2DSquareCellIntChunk,
                                      AbstractGrid2DSquareCell.ChunkID _ChunkID,
                                      int defaultValue)
Creates a new Grid2DSquareCellIntChunkMap

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

getDescription

protected java.lang.String getDescription()
Returns a description of this.

Overrides:
getDescription in class AbstractGrid2DSquareCellChunk

initData

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

Specified by:
initData in class AbstractGrid2DSquareCellIntChunk

getData

public gnu.trove.TIntObjectHashMap getData()
Returns this.data.


clearData

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

Specified by:
clearData in class AbstractGrid2DSquareCellIntChunk

toArrayIncludingNoDataValues

public int[] toArrayIncludingNoDataValues()
Returns values in row major order as a int[].

Overrides:
toArrayIncludingNoDataValues in class AbstractGrid2DSquareCellIntChunk

toArrayNotIncludingNoDataValues

public int[] toArrayNotIncludingNoDataValues()
Returns non noDataValue in row major order as a int[].

Overrides:
toArrayNotIncludingNoDataValues in class AbstractGrid2DSquareCellIntChunk

getCell

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

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

getCell

public int getCell(AbstractGrid2DSquareCellChunk.ChunkCellID chunkCellID,
                   int noDataValue)
Returns the value of cell with CellID given by chunkCellID

Parameters:
chunkCellID - the chunk CellID of cell thats value is to be returned
noDataValue - the noDataValue of this.grid2DSquareCellInt

initCell

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

Specified by:
initCell in class AbstractGrid2DSquareCellIntChunk
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,
                        int valueToInitialise)
Initialises the value of the chunk referred to by chunkCellID to valueToInitialise. Utility method for constructor.

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

setCell

public int setCell(int chunkCellRowIndex,
                   int chunkCellColIndex,
                   int valueToSet,
                   int 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 AbstractGrid2DSquareCellIntChunk
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.grid2DSquareCellInt.

setCell

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

Parameters:
chunkCellID - the AbstractGrid2DSquareCellIntChunk.ChunkCellID of the cell to be initialised
valueToSet - the value the cell is to be set to

getNonNoDataValueCountBigInteger

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

Overrides:
getNonNoDataValueCountBigInteger in class AbstractGrid2DSquareCellIntChunk

getSumBigDecimal

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

Overrides:
getSumBigDecimal in class AbstractGrid2DSquareCellIntChunk

iterator

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

Specified by:
iterator in class AbstractGrid2DSquareCellChunk