uk.ac.leeds.ccg.andyt.grids.core
Class Grid2DSquareCellAbstract.ChunkID

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

public static class Grid2DSquareCellAbstract.ChunkID
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

A simple ChunkID class for distinguishing s in this chunk.

See Also:
Serialized Form

Field Summary
protected  int chunkColIndex
          For storing the chunk column index
protected  int chunkRowIndex
          For storing the chunk row index
protected  int hashCode
          For storing a hashCode for this ChunkID.
 
Constructor Summary
Grid2DSquareCellAbstract.ChunkID()
          Default constructor.
Grid2DSquareCellAbstract.ChunkID(Grid2DSquareCellAbstract.ChunkID chunkID)
          Constructs a new ChunkID that is a clone of chunkID
Grid2DSquareCellAbstract.ChunkID(int nChunkCols, int chunkRowIndex, int chunkColIndex)
          Constructs a new ChunkID
 
Method Summary
 int compareTo(java.lang.Object object)
          Method required by Comparable
 boolean equals(java.lang.Object object)
          Overrides equals in Object
 int getChunkColIndex()
          Returns this.chunkColIndex
 int getChunkRowIndex()
          Returns this.chunkRowIndex
 int hashCode()
          Returns this.hashCode
 java.lang.String toString()
          Returns a description of this
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

chunkRowIndex

protected int chunkRowIndex
For storing the chunk row index


chunkColIndex

protected int chunkColIndex
For storing the chunk column index


hashCode

protected int hashCode
For storing a hashCode for this ChunkID. NB. When the number of cells in a chunk is more than the maximum int value care should be taken to distributed hashcodes in a relatively even way. Operations may slow down greatly if a large number of chunks have ChunkIDs with the same hashCode.

Constructor Detail

Grid2DSquareCellAbstract.ChunkID

public Grid2DSquareCellAbstract.ChunkID()
Default constructor.


Grid2DSquareCellAbstract.ChunkID

public Grid2DSquareCellAbstract.ChunkID(Grid2DSquareCellAbstract.ChunkID chunkID)
Constructs a new ChunkID that is a clone of chunkID

Parameters:
chunkID - The ChunkID to clone.

Grid2DSquareCellAbstract.ChunkID

public Grid2DSquareCellAbstract.ChunkID(int nChunkCols,
                                        int chunkRowIndex,
                                        int chunkColIndex)
Constructs a new ChunkID

Parameters:
chunkRowIndex - the row of the
chunkColIndex - the column of the
nChunkCols - The number of chunk columns (of the grid2DSquareCellAbstract).
Method Detail

hashCode

public int hashCode()
Returns this.hashCode

Overrides:
hashCode in class java.lang.Object

getChunkRowIndex

public int getChunkRowIndex()
Returns this.chunkRowIndex


getChunkColIndex

public int getChunkColIndex()
Returns this.chunkColIndex


toString

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

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