Class games.Battle.shared.sys.Grid
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.shared.sys.Grid

java.lang.Object
   |
   +----games.Battle.shared.sys.Grid

public class Grid
extends Object
Grid is a container which eases access to data arranges in (r,c) grids.

Constructor Index

 o Grid(int, int)
Construct a grid with r rows and c columns.

Method Index

 o getCell(int, int)
Return the data located in the given cell location
 o getData()
Return the contiguous array of data representing this grid.
 o getNumCols()
Return the number of colums in this grid
 o getNumRows()
Return the number of rows in this grid
 o setCell(int, int, Object)
Set the value of the cell in the given (row, col) location with the given object.
 o setData(Object[])
Set the data for this grid object.

Constructors

 o Grid
  public Grid(int r,
              int c)
Construct a grid with r rows and c columns.
Parameters:
r - the number of rows in the grid
c - the number of columns in the grid

Methods

 o getNumRows
  public final int getNumRows()
Return the number of rows in this grid
 o getNumCols
  public final int getNumCols()
Return the number of colums in this grid
 o setCell
  public final void setCell(int row,
                            int col,
                            Object cell)
Set the value of the cell in the given (row, col) location with the given object.
Parameters:
row - the row
col - the column
cell - the data to place in that cell
 o getCell
  public final Object getCell(int row,
                              int col)
Return the data located in the given cell location
Parameters:
row - the row
col - the column
 o getData
  public final Object[] getData()
Return the contiguous array of data representing this grid. The data is arranged in row-major order: for example, in a 2x2 grid, the first 2 elements in the array represent the first row, and the second two elements represent the second row.
 o setData
  public final void setData(Object x[])
Set the data for this grid object. Will raise an IllegalArgumentException if the data block is not the correct size.
Parameters:
data - the data block

All Packages  Class Hierarchy  This Package  Previous  Next  Index