Skip to content
Snippets Groups Projects
Commit 59e45a72 authored by SAIDI Hatim's avatar SAIDI Hatim
Browse files

test

parent 607ff9c0
No related branches found
No related tags found
No related merge requests found
......@@ -7,15 +7,31 @@ public class ArrayGrid implements Grid{
private final int numberOfColumns ;
public ArrayGrid(int numberOfRows,int numberOfColumns){
public ArrayGrid(int numberOfRows,int numberOfColumns) {
this.numberOfRows = numberOfRows;
this.numberOfColumns = numberOfColumns;
this.cells[numberOfRows][numberOfColumns]=new SquareCell();
try {
System.out.println(numberOfColumns<0 || numberOfRows<0);
}catch (IllegalArgumentException e){
System.out.println(e);
if (numberOfColumns > 0 || numberOfRows > 0) {
for (int j = 0; j < this.numberOfColumns; j++) {
for (int i = 0; i < this.numberOfRows; i++) {
cells[numberOfRows][numberOfColumns] = new SquareCell();
}
}
}
else {
throw new IllegalArgumentException() ;
}
}
public Cell getCell(int row, int column) {
return this.cells[row][column];
}
public int getNumberOfRows(){
return this.numberOfRows;
}
public int getNumberOfColumns(){
return this.numberOfColumns;
}
}
......@@ -11,17 +11,19 @@ public class SquareCell extends AbstractCell {
List<Cell> neighbours;
public SquareCell() {
AbstractCell cell = new SquareCell();
Color cell = DEFAULT_CELL_COLOR;
this.neighbours = new ArrayList<>();
}
public SquareCell(Color color){
AbstractCell cell = new SquareCell(color);
Color cell = color;
this.neighbours = new ArrayList<>();
}
public SquareCell(Color color,List<Cell>neighbours){
AbstractCell cell = new SquareCell(color,neighbours);
Color cell = color;
this.neighbours = neighbours;
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment