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

Tâche 4 (7.3) : Modification de la classe UniforExceptOneGenerator, en y...

Tâche 4 (7.3) : Modification de la classe UniforExceptOneGenerator, en y mettant son constructeur et en modifiant la méthode "nextColor"
parent f86e20f4
No related branches found
No related tags found
No related merge requests found
package model;
import javafx.scene.paint.Color;
public class UniformExceptOneGenerator implements ColorGenerator {
Color uniformColor ;
Color exceptionColor ;
//"callednextColor" est une variable vérifiant si la méthode est appelé une fois ou plus
private static int callednextColor = 0 ;
//Constructeur de la classe
public UniformExceptOneGenerator(Color uniformColor, Color exceptionColor) {
this.uniformColor = uniformColor ;
this.exceptionColor = exceptionColor;
}
//Méthode demandée par l'exercice
@Override
public Color nextColor(Cell cell) {
if (callednextColor == 0 ) {
callednextColor++;
return this.uniformColor;
}
else return this.exceptionColor;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment