Game of Life 1.5

org.bitstorm.gameoflife
Interface CellGrid

All Known Implementing Classes:
GameOfLifeGrid

public interface CellGrid

Interface between GameOfLifeCanvas and GameOfLife. This way GameOfLifeCanvas is generic, independent of GameOfLife. It contains generic methods to operate on a cell grid.

Author:
Edwin Martin

Method Summary
 void clear()
          Clears grid.
 boolean getCell(int col, int row)
          Get status of cell (alive or dead).
 java.awt.Dimension getDimension()
          Get dimension of cellgrid.
 java.util.Enumeration getEnum()
          Get cell-enumerator.
 void resize(int col, int row)
          Resize the cell grid.
 void setCell(int col, int row, boolean cell)
          Set status of cell (alive or dead).
 

Method Detail

getCell

public boolean getCell(int col,
                       int row)
Get status of cell (alive or dead).

Parameters:
col - x-position
row - y-position
Returns:
living or not

setCell

public void setCell(int col,
                    int row,
                    boolean cell)
Set status of cell (alive or dead).

Parameters:
col - x-position
row - y-position
cell - living or not

getDimension

public java.awt.Dimension getDimension()
Get dimension of cellgrid.

Returns:
dimension

resize

public void resize(int col,
                   int row)
Resize the cell grid.

Parameters:
col - new number of columns.
row - new number of rows.

getEnum

public java.util.Enumeration getEnum()
Get cell-enumerator. Enumerates over all living cells (type Cell).

Returns:
Enumerator over Cell.
See Also:
Cell

clear

public void clear()
Clears grid.


Game of Life 1.5

This API descibes the Game of Life program, written by Edwin Martin. The source code is available online too.

Copyright 1996-2004 Edwin Martin <edwin@bitstorm.org>.