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.
-
Grid(int, int)
- Construct a grid with r rows and c columns.
-
getCell(int, int)
- Return the data located in the given cell location
-
getData()
- Return the contiguous array of data representing this
grid.
-
getNumCols()
- Return the number of colums in this grid
-
getNumRows()
- Return the number of rows in this grid
-
setCell(int, int, Object)
- Set the value of the cell in the given (row, col) location
with the given object.
-
setData(Object[])
- Set the data for this grid object.
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
getNumRows
public final int getNumRows()
- Return the number of rows in this grid
getNumCols
public final int getNumCols()
- Return the number of colums in this grid
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
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
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.
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