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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.AbstractGrid2DSquareCellChunk
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractGrid2DSquareCellDoubleChunk, AbstractGrid2DSquareCellIntChunk

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

AbstractGrid2DSquareCellChunk 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 AbstractGrid2DSquareCellChunk.ChunkCellID
          A simple ChunkCellID class for distinguishing cells in this chunk.
 
Field Summary
protected  AbstractGrid2DSquareCell.ChunkID _ChunkID
          For storing the ChunkID of this.
protected  AbstractGrid2DSquareCell _Grid2DSquareCell
          A reference to the Grid2DSquareCellDoubleAbstract instance.
protected  boolean isSwapUpToDate
          Indicator for whether the swapped version of this chunk is upToDate.
 
Constructor Summary
AbstractGrid2DSquareCellChunk()
           
 
Method Summary
protected abstract  void clearData()
          For clearing the data associated with this.
protected  AbstractGrid2DSquareCell.ChunkID getChunkID()
          Returns a copy of this._ChunkID.
 AbstractGrid2DSquareCell.ChunkID getChunkID(boolean handleOutOfMemoryError)
          Returns a copy of this._ChunkID.
protected  java.lang.String getDescription()
          For returning a description of this.
protected  AbstractGrid2DSquareCell getGrid2DSquareCell()
          Returns this._Grid2DSquareCell.
 AbstractGrid2DSquareCell 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(AbstractGrid2DSquareCell.ChunkID _ChunkID)
          Initialises _ChunkID.
protected abstract  void initData()
          For initialising the data associated with this.
protected  void initGrid2DSquareCell(AbstractGrid2DSquareCell _Grid2DSquareCell)
          Initialises _Grid2DSquareCell.
protected abstract  AbstractIterator iterator()
          Returns an iterator over the cell values.
 AbstractIterator 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 AbstractGrid2DSquareCell _Grid2DSquareCell
A reference to the Grid2DSquareCellDoubleAbstract instance.


_ChunkID

protected transient AbstractGrid2DSquareCell.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

AbstractGrid2DSquareCellChunk

public AbstractGrid2DSquareCellChunk()
Method Detail

getGrid2DSquareCell

public AbstractGrid2DSquareCell 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 AbstractGrid2DSquareCell getGrid2DSquareCell()
Returns this._Grid2DSquareCell.


initGrid2DSquareCell

protected void initGrid2DSquareCell(AbstractGrid2DSquareCell _Grid2DSquareCell)
Initialises _Grid2DSquareCell.

Parameters:
_Grid2DSquareCell -

initChunkID

protected void initChunkID(AbstractGrid2DSquareCell.ChunkID _ChunkID)
Initialises _ChunkID.

Parameters:
_ChunkID -

getChunkID

public AbstractGrid2DSquareCell.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 AbstractGrid2DSquareCell.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 AbstractIterator 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 AbstractIterator 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.