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

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

public abstract class Grid2DSquareCellChunkAbstract
extends java.lang.Object
implements java.io.Serializable

Grid2DSquareCellChunkAbstract provides inner classes for ChunkCellID and general geometry methods for extended classes. It also controls what methods extended classes must implement acting like an interface. The basic geometries are ordered in set numbers of rows and columns and are arranged sequentially as their base two-dimensional orthogonal coordinate axes. The sequential arrangement goes along the x-axis row by row from the y-axis, then up the y-axis taking each row in turn. TODO: Add an int TYPE attribute field which can be used to switch between different types of instances?

See Also:
Serialized Form

Nested Class Summary
 class Grid2DSquareCellChunkAbstract.ChunkCellID
          A simple ChunkCellID class for distinguishing cells in this chunk.
 
Field Summary
protected  Grid2DSquareCellAbstract.ChunkID chunkID
          For storing the ChunkID of this.
protected  Grid2DSquareCellAbstract grid2DSquareCell
          A reference to the Grid2DSquareCellDoubleAbstract instance.
protected  boolean isSwapUpToDate
          Indicator for whether the swapped version of this chunk is upToDate.
 
Constructor Summary
Grid2DSquareCellChunkAbstract()
           
 
Method Summary
protected abstract  void clearData()
          For clearing the data associated with this.
protected  Grid2DSquareCellAbstract.ChunkID getChunkID()
          Returns a copy of this.chunkID.
 Grid2DSquareCellAbstract.ChunkID getChunkID(boolean handleOutOfMemoryError)
          Returns a copy of this.chunkID.
protected  java.lang.String getDescription()
          For returning a description of this.
protected  Grid2DSquareCellAbstract getGrid2DSquareCell()
          Returns this.grid2DSquareCell.
 Grid2DSquareCellAbstract getGrid2DSquareCell(boolean handleOutOfMemoryError)
          Returns this.grid2DSquareCell.
protected  boolean getIsSwapUpToDate()
          Returns this.isSwapUpToDate
 boolean getIsSwapUpToDate(boolean handleOutOfMemoryError)
          Returns this.isSwapUpToDate
protected  java.lang.String getName()
          Returns the name of this.
 java.lang.String getName(boolean handleOutOfMemoryError)
          Returns the name of this.
protected  boolean inChunk(int chunkCellRowIndex, int chunkCellColIndex)
          Returns true if the cell given by chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex is in this.
 boolean inChunk(int chunkCellRowIndex, int chunkCellColIndex, boolean handleOutOfMemoryError)
          Returns true if the cell given by chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex is in this.
protected  void initChunkID(Grid2DSquareCellAbstract.ChunkID chunkID)
          Initialises chunkID.
protected abstract  void initData()
          For initialising the data associated with this.
protected  void initGrid2DSquareCell(Grid2DSquareCellAbstract grid2DSquareCell)
          Initialises grid2DSquareCell.
protected abstract  IteratorAbstract iterator()
          Returns an iterator over the cell values.
 IteratorAbstract iterator(boolean handleOutOfMemoryError)
          Returns an iterator over the cell values.
protected  void setIsSwapUpToDate(boolean isSwapUpToDate)
          Returns this.isSwapUpToDate
protected  void setIsSwapUpToDate(boolean isSwapUpToDate, boolean handleOutOfMemoryError)
          Sets this.isSwapUpToDate to isSwapUpToDate
 java.lang.String toString(boolean handleOutOfMemoryError)
          For returning a description of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grid2DSquareCell

protected transient Grid2DSquareCellAbstract grid2DSquareCell
A reference to the Grid2DSquareCellDoubleAbstract instance.


chunkID

protected transient Grid2DSquareCellAbstract.ChunkID chunkID
For storing the ChunkID of this. TODO: Is this transient for caching?


isSwapUpToDate

protected transient boolean isSwapUpToDate
Indicator for whether the swapped version of this chunk is upToDate. TODO: This adds a small amount of weight, so for 64CellMap implementations it may be undesirable?

Constructor Detail

Grid2DSquareCellChunkAbstract

public Grid2DSquareCellChunkAbstract()
Method Detail

getGrid2DSquareCell

public Grid2DSquareCellAbstract getGrid2DSquareCell(boolean handleOutOfMemoryError)
Returns this.grid2DSquareCell.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getGrid2DSquareCell

protected Grid2DSquareCellAbstract getGrid2DSquareCell()
Returns this.grid2DSquareCell.


initGrid2DSquareCell

protected void initGrid2DSquareCell(Grid2DSquareCellAbstract grid2DSquareCell)
Initialises grid2DSquareCell.

Parameters:
grid2DSquareCell -

initChunkID

protected void initChunkID(Grid2DSquareCellAbstract.ChunkID chunkID)
Initialises chunkID.

Parameters:
chunkID -

getChunkID

public Grid2DSquareCellAbstract.ChunkID getChunkID(boolean handleOutOfMemoryError)
Returns a copy of this.chunkID.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getChunkID

protected Grid2DSquareCellAbstract.ChunkID getChunkID()
Returns a copy of this.chunkID.


getIsSwapUpToDate

public boolean getIsSwapUpToDate(boolean handleOutOfMemoryError)
Returns this.isSwapUpToDate

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getIsSwapUpToDate

protected boolean getIsSwapUpToDate()
Returns this.isSwapUpToDate


setIsSwapUpToDate

protected void setIsSwapUpToDate(boolean isSwapUpToDate,
                                 boolean handleOutOfMemoryError)
Sets this.isSwapUpToDate to isSwapUpToDate

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

setIsSwapUpToDate

protected void setIsSwapUpToDate(boolean isSwapUpToDate)
Returns this.isSwapUpToDate


toString

public java.lang.String toString(boolean handleOutOfMemoryError)
For returning a description of this.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getDescription

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


getName

public java.lang.String getName(boolean handleOutOfMemoryError)
Returns the name of this.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

getName

protected java.lang.String getName()
Returns the name of this.


iterator

public IteratorAbstract iterator(boolean handleOutOfMemoryError)
Returns an iterator over the cell values. These are not guaranteed to be in any particular order.

Parameters:
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

iterator

protected abstract IteratorAbstract iterator()
Returns an iterator over the cell values. These are not guaranteed to be in any particular order.


inChunk

public boolean inChunk(int chunkCellRowIndex,
                       int chunkCellColIndex,
                       boolean handleOutOfMemoryError)
Returns true if the cell given by chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex is in this.

Parameters:
chunkCellRowIndex -
chunkCellColIndex -
handleOutOfMemoryError - If true then OutOfMemoryErrors are caught, swap operations are initiated, then the method is re-called. If false then OutOfMemoryErrors are caught and thrown.

inChunk

protected boolean inChunk(int chunkCellRowIndex,
                          int chunkCellColIndex)
Returns true if the cell given by chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex is in this.

Parameters:
chunkCellRowIndex -
chunkCellColIndex -

clearData

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


initData

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