|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.univ.paris5.GameOfLife.GridWorld
public class GridWorld
Contains the cellgrid, the current shape and the Game Of Life algorithm that changes it.
Constructor Summary | |
---|---|
GridWorld(Algorithm algorithm,
int cellCols,
int cellRows)
Instance of GridWorld. |
Method Summary | |
---|---|
void |
clear()
Clears grid. |
java.awt.Dimension |
getDimension()
Get dimension of cellgrid. |
java.util.Enumeration |
getEnum()
Get cell-enumerator. |
int |
getGenerations()
Get number of generations. |
Cell |
getNeighbour(int c,
int r)
Get Objet Cell with the possition. |
int |
getPopulation()
Get number population. |
int |
getRandomCell(int n)
Get Random number for state index. |
java.util.Hashtable |
getShape()
Get cell-Hashtable. |
State |
getStateCell(int col,
int row)
Get status of cell. |
void |
initCell(boolean random)
Init all cell for state random |
void |
next()
Create next generation of shape. |
void |
random()
Clears grid. |
void |
resize(int col,
int row)
Resize the cell grid. |
void |
setAlgorithm(Algorithm algo)
|
void |
setCell(int col,
int row,
State state)
Set status of cell (alive or dead). |
void |
setShape(java.util.Hashtable shape)
Set cell-Hashtable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GridWorld(Algorithm algorithm, int cellCols, int cellRows)
algorithm
- cellCols
- cellRows
- Method Detail |
---|
public void initCell(boolean random)
random
- public int getRandomCell(int n)
n
- number-state
public State getStateCell(int col, int row)
getStateCell
in interface Grid
col
- x-positionrow
- y-position
public void setCell(int col, int row, State state)
setCell
in interface Grid
col
- x-positionrow
- y-positioncell
- living or notpublic Cell getNeighbour(int c, int r)
c
- r
-
public void next()
public void clear()
clear
in interface Grid
public void random()
public void resize(int col, int row)
resize
in interface Grid
col
- new number of columns.row
- new number of rows.public int getGenerations()
public java.awt.Dimension getDimension()
getDimension
in interface Grid
public java.util.Enumeration getEnum()
getEnum
in interface Grid
Cell
public java.util.Hashtable getShape()
Cell
public void setShape(java.util.Hashtable shape)
Hashtable
- shapeCell
public void setAlgorithm(Algorithm algo)
algorithm
- the algorithm to setpublic int getPopulation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |