package gameoflife3;
public class BooleanArrayColony implements Colony {
private int width;
private int height;
private boolean[][] grid;
public BooleanArrayColony(int y, int x) {
this.width = y;
this.height = x;
grid = new boolean[width][height];
}
public void copyInto(Colony copyTo, int y, int x, boolean deadKillLive) {
}
public boolean getCell(int y, int x) {
if(y < getWidth() && y >= 0 && x < getWidth() && x >= 0) {
return grid[y][x];
}
return false;
}
public int getHeight() {
return this.height;
}
public int getWidth() {
return this.width;
}
public boolean isEmpty() {
for (int i = 0; i < this.getWidth(); i++) {
for (int j = 0; j < this.getHeight(); j++) {
if (grid[i][j]) return false;
}
}
return true;
}
public void setCell(int y, int x, boolean state) {
if(y < getWidth() && y >= 0 && x < getHeight() && x >= 0) {
grid[y][x] = state;
}
}
}