From 2766582145b93573664405ae52be8c0fdc7c4e87 Mon Sep 17 00:00:00 2001
From: b21221851 <mohamed-amine.BEL-KHALIFA@etu.univ-amu.fr>
Date: Wed, 2 Nov 2022 09:32:42 +0100
Subject: [PATCH] Class SquareCell and ArrayGrid

---
 app/src/main/java/model/ArrayGrid.java  | 29 +++++++++++++++++++++++++
 app/src/main/java/model/SquareCell.java |  7 +++---
 2 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 app/src/main/java/model/ArrayGrid.java

diff --git a/app/src/main/java/model/ArrayGrid.java b/app/src/main/java/model/ArrayGrid.java
new file mode 100644
index 0000000..e71e893
--- /dev/null
+++ b/app/src/main/java/model/ArrayGrid.java
@@ -0,0 +1,29 @@
+package model;
+
+public class ArrayGrid implements Grid{
+
+    public void arrayGrid(int numberOfRows, int numberOfColumn) {
+        if(numberOfRows <= 0 || numberOfColumn <= 0)
+            throw new IllegalArgumentException("Le nombre de lignes ou de colonnes ne peut pas être nul ou négatif.");
+        Cell[][] cells = new Cell[numberOfRows][numberOfColumn];
+        for(int i = 0; i < numberOfRows; i++) {
+            for(int j = 0; j < numberOfColumn; j++) {
+                cells[i][j] = new SquareCell();
+            }
+        }
+    }
+    @Override
+    public Cell getCell(int row, int column) {
+        return null;
+    }
+
+    @Override
+    public int getNumberOfRows() {
+        return 0;
+    }
+
+    @Override
+    public int getNumberOfColumns() {
+        return 0;
+    }
+}
diff --git a/app/src/main/java/model/SquareCell.java b/app/src/main/java/model/SquareCell.java
index 3b3f157..fd829d0 100644
--- a/app/src/main/java/model/SquareCell.java
+++ b/app/src/main/java/model/SquareCell.java
@@ -7,7 +7,7 @@ import java.util.List;
 
 public class SquareCell extends AbstractCell{
 
-    List<Cell> neighbours;
+
     public void squareCell() {
         Color DEFAULT_CELL_COLOR;
         List<Cell> neighbours;
@@ -25,15 +25,14 @@ public class SquareCell extends AbstractCell{
 
 
 
+
     /**
      * A cell is placed somewhere on a grid. Its neighbours thus depend on the underlying grid.
      *
      * @return the list of cell that are neighbours of this{@code Cell}.
      */
     @Override
-    public List<Cell> getNeighbours() {
-        return null;
-    }
+    public List<Cell> getNeighbours() {return null;}
 
     /**
      * Update the list of neighbours of this {@code Cell}.
-- 
GitLab