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

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellChunkAbstract.ChunkCellID
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Enclosing class:
Grid2DSquareCellChunkAbstract

public class Grid2DSquareCellChunkAbstract.ChunkCellID
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

A simple ChunkCellID class for distinguishing cells in this chunk.

See Also:
Serialized Form

Field Summary
protected  int chunkCellColIndex
          For storing the column in which the cell is positioned
protected  int chunkCellRowIndex
          For storing the row in which the cell is positioned
protected  int hashCode
          For storing a hashCode for the cell.
 
Constructor Summary
protected Grid2DSquareCellChunkAbstract.ChunkCellID()
          Constructs a new ChunkCellID
protected Grid2DSquareCellChunkAbstract.ChunkCellID(int chunkCellRowIndex, int chunkCellColIndex)
          Constructs a new ChunkCellID
protected Grid2DSquareCellChunkAbstract.ChunkCellID(int chunkNcols, int chunkCellRowIndex, int chunkCellColIndex)
          Constructs a new ChunkCellID
 
Method Summary
 int compareTo(java.lang.Object object)
          Method required by Comparable
 boolean equals(java.lang.Object object)
          Overrides equals in Object
 long getChunkCellColIndex()
          Returns chunkCellColIndex of this CellID
 long getChunkCellRowIndex()
          Returns chunkCellRowIndex of this CellID
 int hashCode()
          Returns hashCode of this CellID
 java.lang.String toString()
          Returns a description of this CellID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

chunkCellRowIndex

protected int chunkCellRowIndex
For storing the row in which the cell is positioned


chunkCellColIndex

protected int chunkCellColIndex
For storing the column in which the cell is positioned


hashCode

protected int hashCode
For storing a hashCode for the cell. NB. When the number of cells in a grid is more than the maximum int value care should be taken to distributed hashcodes in a relatively even way. Operations will slow down greatly if a large number of cells have a ChunkCellID with the same hashCode.

Constructor Detail

Grid2DSquareCellChunkAbstract.ChunkCellID

protected Grid2DSquareCellChunkAbstract.ChunkCellID()
Constructs a new ChunkCellID


Grid2DSquareCellChunkAbstract.ChunkCellID

protected Grid2DSquareCellChunkAbstract.ChunkCellID(int chunkCellRowIndex,
                                                    int chunkCellColIndex)
Constructs a new ChunkCellID

Parameters:
chunkCellRowIndex - the row of the cell
chunkCellColIndex - the column of the cell

Grid2DSquareCellChunkAbstract.ChunkCellID

protected Grid2DSquareCellChunkAbstract.ChunkCellID(int chunkNcols,
                                                    int chunkCellRowIndex,
                                                    int chunkCellColIndex)
Constructs a new ChunkCellID

Parameters:
chunkCellRowIndex - the row of the cell
chunkCellColIndex - the column of the cell
chunkNcols - the number of columns in the chunk
Method Detail

hashCode

public int hashCode()
Returns hashCode of this CellID

Overrides:
hashCode in class java.lang.Object

getChunkCellRowIndex

public long getChunkCellRowIndex()
Returns chunkCellRowIndex of this CellID


getChunkCellColIndex

public long getChunkCellColIndex()
Returns chunkCellColIndex of this CellID


toString

public java.lang.String toString()
Returns a description of this CellID

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides equals in Object

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object object)
Method required by Comparable

Specified by:
compareTo in interface java.lang.Comparable