Skip to content
Snippets Groups Projects
Commit 994e693c authored by RAKOTOARISOA Andrianinarisaina cy's avatar RAKOTOARISOA Andrianinarisaina cy
Browse files

Tâche 3 (6.1) : Modification de l'interface Grid pour qu’elle étende...

Tâche 3 (6.1) : Modification de l'interface Grid pour qu’elle étende l’interface Iterable<Cell> / Ajout de la méthode "public Iterator<Cell> iterator()" dans la classe ArrayGrid / Ajout de la boucle "for(Cell cell : this)" dans la méthode "color"
parent 3b479aef
No related branches found
No related tags found
No related merge requests found
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();
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment