refactor: rename methods to French for consistency in the Sudoku application
This commit is contained in:
@@ -34,7 +34,7 @@ public class App {
|
|||||||
sudoku.getGrille().setCase(0, 7, Symbole.of(8));
|
sudoku.getGrille().setCase(0, 7, Symbole.of(8));
|
||||||
sudoku.getGrille().setCase(4, 8, Symbole.of(9));
|
sudoku.getGrille().setCase(4, 8, Symbole.of(9));
|
||||||
|
|
||||||
sudoku.getGrille().createSquareBlocs();
|
sudoku.getGrille().creerBlocCarre();
|
||||||
|
|
||||||
System.out.println("Sudoku :");
|
System.out.println("Sudoku :");
|
||||||
System.out.println(sudoku.getGrille().toString());
|
System.out.println(sudoku.getGrille().toString());
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class Bloc {
|
|||||||
this.cases = new ArrayList<>();
|
this.cases = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCase(Case c) {
|
public void ajouterCase(Case c) {
|
||||||
cases.add(c);
|
cases.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Grille {
|
|||||||
* Crée un bloc à partir des positions spécifiées
|
* Crée un bloc à partir des positions spécifiées
|
||||||
*
|
*
|
||||||
* Exemple :
|
* Exemple :
|
||||||
* sudoku.getGrille().createBloc(Arrays.asList(
|
* sudoku.getGrille().creerBloc(Arrays.asList(
|
||||||
* new int[] { 0, 0 },
|
* new int[] { 0, 0 },
|
||||||
* new int[] { 0, 1 },
|
* new int[] { 0, 1 },
|
||||||
* new int[] { 0, 2 },
|
* new int[] { 0, 2 },
|
||||||
@@ -60,16 +60,16 @@ public class Grille {
|
|||||||
* @param positions
|
* @param positions
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Bloc createBloc(List<int[]> positions) {
|
public Bloc creerBloc(List<int[]> positions) {
|
||||||
Bloc bloc = new Bloc();
|
Bloc bloc = new Bloc();
|
||||||
for (int[] pos : positions) {
|
for (int[] pos : positions) {
|
||||||
bloc.addCase(cases[pos[0]][pos[1]]);
|
bloc.ajouterCase(cases[pos[0]][pos[1]]);
|
||||||
}
|
}
|
||||||
blocs.add(bloc);
|
blocs.add(bloc);
|
||||||
return bloc;
|
return bloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSquareBlocs() {
|
public void creerBlocCarre() {
|
||||||
try {
|
try {
|
||||||
int blocSize = (int) Math.sqrt(taille);
|
int blocSize = (int) Math.sqrt(taille);
|
||||||
if (blocSize * blocSize != taille) {
|
if (blocSize * blocSize != taille) {
|
||||||
@@ -83,7 +83,7 @@ public class Grille {
|
|||||||
positions.add(new int[] { i + k, j + l });
|
positions.add(new int[] { i + k, j + l });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createBloc(positions);
|
creerBloc(positions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user