diff --git a/app/src/main/java/model/Grid.java b/app/src/main/java/model/Grid.java index cedbaca3df49b6f663b538b1ab604ad2c6c22b71..948369cd21edde306702ededa82f07d880ccf4f8 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(); /**