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 a 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
abstract  void clearData()
          For clearing the data associated with this.
 Grid2DSquareCellAbstract.ChunkID getChunkID()
          Returns a copy of this.chunkID.
 Grid2DSquareCellAbstract getGrid2DSquareCell()
          Returns this.grid2DSquareCell.
protected  boolean getIsSwapUpToDate()
          Returns this.isSwapUpToDate
 java.lang.String getName()
          Returns the name of this.
 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.
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.
abstract  IteratorAbstract iterator()
          Returns an iterator over the cell values.
protected  void setIsSwapUpToDate(boolean isSwapUpToDate)
          Returns this.isSwapUpToDate
abstract  java.lang.String toString()
          For returning a descritption of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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. 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()
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()
Returns a copy of this.chunkID. TODO: Check that returning a clone is fine.


getIsSwapUpToDate

protected boolean getIsSwapUpToDate()
Returns this.isSwapUpToDate


setIsSwapUpToDate

protected void setIsSwapUpToDate(boolean isSwapUpToDate)
Returns this.isSwapUpToDate


toString

public abstract java.lang.String toString()
For returning a descritption of this.

Overrides:
toString in class java.lang.Object

getName

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


iterator

public 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)
Returns true if the cell given by chunk cell row index chunkCellRowIndex, chunk cell col index chunkCellColIndex is in this.

Parameters:
chunkCellRowIndex -
chunkCellColIndex -

clearData

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


initData

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