Game-of-Life-WSU-CEG4180  v0.1
RefactoringtheGameofLife
CellGrid.java
Go to the documentation of this file.
1 /* This page is part of the Game of Life source code */
2 
3 /**
4  * Interface to Game of Life Grid.
5  * The CellGridCanvas can deal with any grid, not only the Game of Life.
6  * Copyright 1996-2004 Edwin Martin <edwin@bitstorm.nl>
7  * @author Edwin Martin
8  */
9 
10 package org.bitstorm.gameoflife;
11 
12 import java.awt.Dimension;
13 import java.util.Enumeration;
14 
15 /**
16  * Interface between GameOfLifeCanvas and GameOfLife.
17  * This way GameOfLifeCanvas is generic, independent of GameOfLife.
18  * It contains generic methods to operate on a cell grid.
19  *
20  * @author Edwin Martin
21  */
22 public interface CellGrid {
23  /**
24  * Get status of cell (alive or dead).
25  * @param col x-position
26  * @param row y-position
27  * @return living or not
28  */
29  public boolean getCell( int col, int row );
30 
31  /**
32  * Set status of cell (alive or dead).
33  * @param col x-position
34  * @param row y-position
35  * @param cell living or not
36  */
37  public void setCell( int col, int row, boolean cell );
38 
39  /**
40  * Get dimension of cellgrid.
41  * @return dimension
42  */
43  public Dimension getDimension();
44 
45  /**
46  * Resize the cell grid.
47  * @param col new number of columns.
48  * @param row new number of rows.
49  */
50  public void resize( int col, int row );
51 
52  /**
53  * Get cell-enumerator. Enumerates over all living cells (type Cell).
54  * @return Enumerator over Cell.
55  * @see Cell
56  */
57  public Enumeration getEnum();
58 
59  /**
60  * Clears grid.
61  */
62  public void clear();
63 }
void setCell(int col, int row, boolean cell)
boolean getCell(int col, int row)
void resize(int col, int row)