From 994e693c712acadbb5e433734cca3f7e89d7554d Mon Sep 17 00:00:00 2001
From: r20004714 <andrianinarisaina-cy.RAKOTOARISOA@etu.univ-amu.fr>
Date: Mon, 14 Nov 2022 17:57:50 +0100
Subject: [PATCH] =?UTF-8?q?T=C3=A2che=203=20(6.1)=20:=20Modification=20de?=
 =?UTF-8?q?=20l'interface=20Grid=20pour=20qu=E2=80=99elle=20=C3=A9tende=20?=
 =?UTF-8?q?l=E2=80=99interface=20Iterable<Cell>=20/=20Ajout=20de=20la=20m?=
 =?UTF-8?q?=C3=A9thode=20"public=20Iterator<Cell>=20iterator()"=20dans=20l?=
 =?UTF-8?q?a=20classe=20ArrayGrid=20/=20Ajout=20de=20la=20boucle=20"for(Ce?=
 =?UTF-8?q?ll=20cell=20:=20this)"=20dans=20la=20m=C3=A9thode=20"color"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/src/main/java/model/Grid.java | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/app/src/main/java/model/Grid.java b/app/src/main/java/model/Grid.java
index cedbaca..948369c 100644
--- a/app/src/main/java/model/Grid.java
+++ b/app/src/main/java/model/Grid.java
@@ -1,23 +1,23 @@
 package model;
 
-public interface  Grid  {
+import java.util.Iterator;
 
-    /**
-     * Return the cell located at the given coordinates in the grid.
-     * @param row the row of the returned the cell
-     * @param column the column of the returned cell
-     * @return the cell located in row {@code row} and in column {@code column}
-     */
+// l'Interface  Iterable<Cell> n'a qu'une seule méthode nommée iterator()
+public interface  Grid  extends Iterable<Cell> {
 
     //Méthode demandée par l'exercice
-    public void color (ColorGenerator colorGenerator);
+    public default void color(ColorGenerator colorGenerator) {
+        for (Cell cell : this) ;
+    };
 
+    //Méthode getCell
     Cell getCell(int row, int column);
 
-    /**
-     * Return the number of rows of this {@code Grid}
-     * @return the number of rows of this {@code Grid}
-     */
+    // definition de la methode iterator()
+    public Iterator<Cell> iterator();
+
+
+    //Méthode getNumberOfRows
     int getNumberOfRows();
 
     /**
-- 
GitLab