Commit b50da5f5e18388a7997c9484ae31601e66357d32
1 parent
b08d24fc
update app
Showing
2 changed files
with
235 additions
and
269 deletions
Show diff stats
src/app/Menu.java
@@ -19,7 +19,6 @@ import java.io.File; | @@ -19,7 +19,6 @@ import java.io.File; | ||
19 | import java.io.FileOutputStream; | 19 | import java.io.FileOutputStream; |
20 | import java.io.IOException; | 20 | import java.io.IOException; |
21 | import java.io.ObjectOutputStream; | 21 | import java.io.ObjectOutputStream; |
22 | -import java.util.ArrayList; | ||
23 | import java.util.Arrays; | 22 | import java.util.Arrays; |
24 | import java.util.List; | 23 | import java.util.List; |
25 | import java.util.Objects; | 24 | import java.util.Objects; |
@@ -28,292 +27,259 @@ import java.util.regex.Matcher; | @@ -28,292 +27,259 @@ import java.util.regex.Matcher; | ||
28 | import java.util.regex.Pattern; | 27 | import java.util.regex.Pattern; |
29 | import java.util.stream.Collectors; | 28 | import java.util.stream.Collectors; |
30 | 29 | ||
31 | - | ||
32 | - | ||
33 | public class Menu { | 30 | public class Menu { |
34 | - public static void main(String[] args) throws IOException, CellNotFoundException, CreateCycleException, BadSyntaxException { | ||
35 | - File fichier = new File("grille.ser"); | 31 | + |
32 | + public static void main(String[] args) throws IOException, CellNotFoundException { | ||
33 | + File fichier = new File("grid.data"); | ||
36 | 34 | ||
37 | // ouverture d'un flux sur un fichier | 35 | // ouverture d'un flux sur un fichier |
38 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fichier)); | 36 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fichier)); |
39 | 37 | ||
40 | Grid grid = new Grid(); | 38 | Grid grid = new Grid(); |
41 | 39 | ||
42 | - Scanner in=new Scanner(System.in); | ||
43 | - | ||
44 | - | ||
45 | - int choix=0; | ||
46 | - String column=""; | ||
47 | - String formula=""; | 40 | + Scanner in = new Scanner(System.in); |
41 | + | ||
42 | + int choice; | ||
43 | + String column; | ||
48 | int line; | 44 | int line; |
49 | 45 | ||
50 | myLanguage(); | 46 | myLanguage(); |
51 | - do { | ||
52 | - menu(); | ||
53 | - System.out.print("VOTRE CHOIX? "); | ||
54 | - choix = in.nextInt(); | ||
55 | - switch (choix) { | ||
56 | - case 1 : | ||
57 | - try { | ||
58 | - createCase(grid); | ||
59 | - } catch (CreateCycleException | CellNotFoundException | BadSyntaxException e) { | ||
60 | - | ||
61 | - e.getMessage();} | ||
62 | - break; | ||
63 | - case 2 : | ||
64 | - try { | ||
65 | - setCase(grid); | ||
66 | - } catch (CreateCycleException | CellNotFoundException | BadSyntaxException e) { | ||
67 | - | ||
68 | - e.getMessage();} | ||
69 | - break; | ||
70 | - case 3 : | ||
71 | - System.out.println("\n Entrez la colonne de la case"); | ||
72 | - column= in.next(); | ||
73 | - System.out.println("\n Entrez la ligne de la case"); | ||
74 | - line= in.nextInt(); | ||
75 | - System.out.println(grid.getCell(column, line).getId()+ ": " + grid.getCell(column, line).getDevelopedFormula()); | ||
76 | - break; | ||
77 | - case 4 : | ||
78 | - System.out.println("\n Entrez la colonne de la case"); | ||
79 | - column= in.next(); | ||
80 | - System.out.println("\n Entrez la ligne de la case"); | ||
81 | - line= in.nextInt(); | ||
82 | - System.out.println(grid.getCell(column, line).getId()+ ": " + grid.getCell(column, line).toString()); | ||
83 | - | ||
84 | - break; | ||
85 | - case 5 : | ||
86 | - System.out.println("\n Entrez la colonne de la case"); | ||
87 | - column= in.next(); | ||
88 | - System.out.println("\n Entrez la ligne de la case"); | ||
89 | - line= in.nextInt(); | ||
90 | - System.out.println(grid.getCell(column, line).getId()+ ": " + grid.getCell(column, line).getValue()); | ||
91 | - | ||
92 | - break; | ||
93 | - case 6 : | ||
94 | - | ||
95 | - gridPrint(grid); | ||
96 | - break; | ||
97 | - | ||
98 | - case 0: // quitter | ||
99 | - } | ||
100 | - } while (choix!=0); | ||
101 | - | ||
102 | - | 47 | + do { |
48 | + menu(); | ||
49 | + System.out.print("VOTRE CHOIX? "); | ||
50 | + choice = in.nextInt(); | ||
51 | + switch (choice) { | ||
52 | + case 1: | ||
53 | + try { | ||
54 | + createCase(grid); | ||
55 | + } catch (CreateCycleException | CellNotFoundException | BadSyntaxException e) { | ||
56 | + | ||
57 | + e.getMessage(); | ||
58 | + } | ||
59 | + break; | ||
60 | + case 2: | ||
61 | + try { | ||
62 | + setCase(grid); | ||
63 | + } catch (CreateCycleException | CellNotFoundException | BadSyntaxException e) { | ||
64 | + | ||
65 | + e.getMessage(); | ||
66 | + } | ||
67 | + break; | ||
68 | + case 3: | ||
69 | + System.out.println("\n Entrez la colonne de la case"); | ||
70 | + column = in.next(); | ||
71 | + System.out.println("\n Entrez la ligne de la case"); | ||
72 | + line = in.nextInt(); | ||
73 | + System.out.println(grid.getCell(column, line).getId() + ": " + grid.getCell(column, line).getDevelopedFormula()); | ||
74 | + break; | ||
75 | + case 4: | ||
76 | + System.out.println("\n Entrez la colonne de la case"); | ||
77 | + column = in.next(); | ||
78 | + System.out.println("\n Entrez la ligne de la case"); | ||
79 | + line = in.nextInt(); | ||
80 | + System.out.println(grid.getCell(column, line).getId() + ": " + grid.getCell(column, line).toString()); | ||
81 | + break; | ||
82 | + case 5: | ||
83 | + System.out.println("\n Entrez la colonne de la case"); | ||
84 | + column = in.next(); | ||
85 | + System.out.println("\n Entrez la ligne de la case"); | ||
86 | + line = in.nextInt(); | ||
87 | + System.out.println(grid.getCell(column, line).getId() + ": " + grid.getCell(column, line).getValue()); | ||
88 | + break; | ||
89 | + case 6: | ||
90 | + gridPrint(grid); | ||
91 | + break; | ||
92 | + case 0: // quitter | ||
93 | + } | ||
94 | + } while (choice != 0); | ||
103 | 95 | ||
104 | oos.writeObject(grid); | 96 | oos.writeObject(grid); |
105 | oos.close(); | 97 | oos.close(); |
106 | System.out.println("\n Adiós"); | 98 | System.out.println("\n Adiós"); |
107 | } | 99 | } |
108 | 100 | ||
101 | + private static void menu() { | ||
102 | + System.out.println("\n1: CREER UNE CASE \n2: MODIFIER UNE CASE\n3:AFFICHER FORMULE DEVELOPPEEE CASE\n4:AFFICHER FORMULE CASE\n5:AFFICHER VALEUR CASE\n6:AFFICHER GRILLE\n0: QUITTER"); | ||
103 | + } | ||
109 | 104 | ||
110 | - static void menu() { | ||
111 | - System.out.println("\n1: CREER UNE CASE \n2: MODIFIER UNE CASE\n3:AFFICHER FORMULE DEVELOPPEEE CASE\n4:AFFICHER FORMULE CASE\n5:AFFICHER VALEUR CASE\n6:AFFICHER GRILLE\n0: QUITTER"); | ||
112 | - } | ||
113 | - | ||
114 | - static void createCase(Grid grid) throws CreateCycleException, CellNotFoundException, BadSyntaxException { | ||
115 | - | ||
116 | - Scanner in=new Scanner(System.in); | ||
117 | - | ||
118 | - String column=""; | ||
119 | - String formula=""; | ||
120 | - int line; | ||
121 | - int choix=0; | ||
122 | - double value; | ||
123 | - do { | ||
124 | - System.out.println("\n1: Case avec valeur\n2: Case avec formule\n0: Quitter"); | ||
125 | - System.out.print("votre choix? "); | ||
126 | - choix = in.nextInt(); | ||
127 | - switch (choix) { | ||
128 | - case 1 : | ||
129 | - try { | ||
130 | - System.out.println("\n Entrez la colonne de la case"); | ||
131 | - column= in.next(); | ||
132 | - System.out.println("\n Entrez la ligne de la case"); | ||
133 | - line= in.nextInt(); | ||
134 | - System.out.println("\n Entrez la valeur de la case"); | ||
135 | - value=in.nextDouble(); | ||
136 | - grid.createCell(column, line, value); | ||
137 | - | ||
138 | - } catch (InvalidIntervalException exception) { | ||
139 | - System.out.println(exception.getMessage());} | ||
140 | - break; | ||
141 | - case 2 : | ||
142 | - try { | ||
143 | - System.out.println("\n Entrez la colonne de la case"); | ||
144 | - column= in.next(); | ||
145 | - System.out.println("\n Entrez la ligne de la case"); | ||
146 | - line= in.nextInt(); | ||
147 | - System.out.println("\n Entrez la formule (Ex: (A1+A2) ou SOMME(A1,A2)"); | ||
148 | - formula=in.next(); | ||
149 | - grid.createCell(column, line, generateFormulaWithString(formula, grid)); | ||
150 | - | ||
151 | - | ||
152 | - } catch (InvalidIntervalException exception) { | ||
153 | - System.out.println(exception.getMessage());} | ||
154 | - break; | ||
155 | - | ||
156 | - | ||
157 | - case 0: // quitter | ||
158 | - } | ||
159 | - } while (choix!=0); | ||
160 | - | ||
161 | - } | ||
162 | - | ||
163 | - | ||
164 | - static void gridPrint(Grid grid) throws CreateCycleException, CellNotFoundException, BadSyntaxException { | ||
165 | - | ||
166 | - Scanner in=new Scanner(System.in); | ||
167 | - | ||
168 | - List<Cell> cells = grid.getCells(); | ||
169 | - int choix=0; | ||
170 | - do { | ||
171 | - System.out.println("\n1: Afficher cases avec valeurs\n2: Afficher cases avec formules\n3: Afficher cases avec formules dévéloppées\n0: Quitter"); | ||
172 | - System.out.print("votre choix? "); | ||
173 | - choix = in.nextInt(); | ||
174 | - switch (choix) { | ||
175 | - case 1 : | ||
176 | - | ||
177 | - | ||
178 | - System.out.println("Affichage des valeurs :"); | ||
179 | - for (Cell cell : cells) | ||
180 | - System.out.println(cell.getId() + ": " + cell.getValue()); | ||
181 | - break; | ||
182 | - | ||
183 | - case 2 : | ||
184 | - System.out.println("Affichage des formules :"); | ||
185 | - for (Cell cell : cells) | ||
186 | - System.out.println(cell.getId() + ": " + cell.toString()); | ||
187 | - | ||
188 | - break; | ||
189 | - | ||
190 | - case 3 : | ||
191 | - System.out.println("Affichage des formules développées :"); | ||
192 | - for (Cell cell : cells) | ||
193 | - System.out.println(cell.getId() + ": " + cell.getDevelopedFormula()); | ||
194 | - | ||
195 | - break; | ||
196 | - case 0: // quitter | ||
197 | - } | ||
198 | - } while (choix!=0); | ||
199 | - | ||
200 | - } | ||
201 | - | ||
202 | - | ||
203 | - | ||
204 | - static void setCase(Grid grid) throws CreateCycleException, CellNotFoundException, BadSyntaxException { | ||
205 | - | ||
206 | - Scanner in=new Scanner(System.in); | ||
207 | - | ||
208 | - String column=""; | ||
209 | - String formula=""; | ||
210 | - int line; | ||
211 | - int choix=0; | ||
212 | - double value; | ||
213 | - do { | ||
214 | - System.out.println("\n1: Modifier case avec valeur\n2: Modifier case avec formule\n0: QUITTER"); | ||
215 | - System.out.print("votre choix? "); | ||
216 | - choix = in.nextInt(); | ||
217 | - switch (choix) { | ||
218 | - case 1 : | ||
219 | - System.out.println("\n Entrez la colonne de la case"); | ||
220 | - column= in.next(); | ||
221 | - System.out.println("\n Entrez la ligne de la case"); | ||
222 | - line= in.nextInt(); | ||
223 | - System.out.println("\n Entrez la valeur de la case"); | ||
224 | - value=in.nextDouble(); | ||
225 | - grid.setValue(column, line, value); | ||
226 | - break; | ||
227 | - case 2 : | ||
228 | - System.out.println("\n Entrez la colonne de la case"); | ||
229 | - column= in.next(); | ||
230 | - System.out.println("\n Entrez la ligne de la case"); | ||
231 | - line= in.nextInt(); | ||
232 | - System.out.println("\n Entrez la formule (Ex: (A1+A2) ou SOMME(A1,A2)"); | ||
233 | - formula=in.next(); | ||
234 | - grid.setFormula(column, line, generateFormulaWithString(formula, grid)); | ||
235 | - break; | ||
236 | - | ||
237 | - | ||
238 | - case 0: // quitter | ||
239 | - } | ||
240 | - } while (choix!=0); | ||
241 | - | ||
242 | - } | ||
243 | - | ||
244 | - private static Formula generateFormulaWithString(String input,Grid grid) throws CellNotFoundException, BadSyntaxException { | ||
245 | - Pattern functionPattern = Pattern.compile("([A-Z]+)\\(([A-Z0-9,]+)\\)"); | ||
246 | - Matcher functionMatcher = functionPattern.matcher(input); | 105 | + private static void createCase(Grid grid) throws CreateCycleException, CellNotFoundException, BadSyntaxException { |
106 | + Scanner in = new Scanner(System.in); | ||
107 | + | ||
108 | + String column; | ||
109 | + String formula; | ||
110 | + int line; | ||
111 | + int choice; | ||
112 | + double value; | ||
113 | + do { | ||
114 | + System.out.println("\n1: Case avec valeur\n2: Case avec formule\n0: Quitter"); | ||
115 | + System.out.print("votre choix? "); | ||
116 | + choice = in.nextInt(); | ||
117 | + switch (choice) { | ||
118 | + case 1: | ||
119 | + try { | ||
120 | + System.out.println("\n Entrez la colonne de la case"); | ||
121 | + column = in.next(); | ||
122 | + System.out.println("\n Entrez la ligne de la case"); | ||
123 | + line = in.nextInt(); | ||
124 | + System.out.println("\n Entrez la valeur de la case"); | ||
125 | + value = in.nextDouble(); | ||
126 | + grid.createCell(column, line, value); | ||
127 | + | ||
128 | + } catch (InvalidIntervalException exception) { | ||
129 | + System.out.println(exception.getMessage()); | ||
130 | + } | ||
131 | + break; | ||
132 | + case 2: | ||
133 | + try { | ||
134 | + System.out.println("\n Entrez la colonne de la case"); | ||
135 | + column = in.next(); | ||
136 | + System.out.println("\n Entrez la ligne de la case"); | ||
137 | + line = in.nextInt(); | ||
138 | + System.out.println("\n Entrez la formule (Ex: (A1+A2) ou SOMME(A1,A2)"); | ||
139 | + formula = in.next(); | ||
140 | + grid.createCell(column, line, generateFormulaWithString(formula, grid)); | ||
141 | + } catch (InvalidIntervalException exception) { | ||
142 | + System.out.println(exception.getMessage()); | ||
143 | + } | ||
144 | + break; | ||
145 | + case 0: // quitter | ||
146 | + } | ||
147 | + } while (choice != 0); | ||
148 | + | ||
149 | + } | ||
150 | + | ||
151 | + private static void gridPrint(Grid grid) { | ||
152 | + Scanner in = new Scanner(System.in); | ||
153 | + | ||
154 | + List<Cell> cells = grid.getCells(); | ||
155 | + int choice; | ||
156 | + do { | ||
157 | + System.out.println("\n1: Afficher cases avec valeurs\n2: Afficher cases avec formules\n3: Afficher cases avec formules dévéloppées\n0: Quitter"); | ||
158 | + System.out.print("votre choix? "); | ||
159 | + choice = in.nextInt(); | ||
160 | + switch (choice) { | ||
161 | + case 1: | ||
162 | + System.out.println("Affichage des valeurs :"); | ||
163 | + for (Cell cell : cells) | ||
164 | + System.out.println(cell.getId() + ": " + cell.getValue()); | ||
165 | + break; | ||
166 | + case 2: | ||
167 | + System.out.println("Affichage des formules :"); | ||
168 | + for (Cell cell : cells) | ||
169 | + System.out.println(cell.getId() + ": " + cell.toString()); | ||
170 | + break; | ||
171 | + case 3: | ||
172 | + System.out.println("Affichage des formules développées :"); | ||
173 | + for (Cell cell : cells) | ||
174 | + System.out.println(cell.getId() + ": " + cell.getDevelopedFormula()); | ||
175 | + break; | ||
176 | + case 0: // quitter | ||
177 | + } | ||
178 | + } while (choice != 0); | ||
179 | + } | ||
180 | + | ||
181 | + private static void setCase(Grid grid) throws CreateCycleException, CellNotFoundException, BadSyntaxException { | ||
182 | + Scanner in = new Scanner(System.in); | ||
183 | + | ||
184 | + String column; | ||
185 | + String formula; | ||
186 | + int line; | ||
187 | + int choice; | ||
188 | + double value; | ||
189 | + do { | ||
190 | + System.out.println("\n1: Modifier case avec valeur\n2: Modifier case avec formule\n0: QUITTER"); | ||
191 | + System.out.print("votre choix? "); | ||
192 | + choice = in.nextInt(); | ||
193 | + switch (choice) { | ||
194 | + case 1: | ||
195 | + System.out.println("\n Entrez la colonne de la case"); | ||
196 | + column = in.next(); | ||
197 | + System.out.println("\n Entrez la ligne de la case"); | ||
198 | + line = in.nextInt(); | ||
199 | + System.out.println("\n Entrez la valeur de la case"); | ||
200 | + value = in.nextDouble(); | ||
201 | + grid.setValue(column, line, value); | ||
202 | + break; | ||
203 | + case 2: | ||
204 | + System.out.println("\n Entrez la colonne de la case"); | ||
205 | + column = in.next(); | ||
206 | + System.out.println("\n Entrez la ligne de la case"); | ||
207 | + line = in.nextInt(); | ||
208 | + System.out.println("\n Entrez la formule (Ex: (A1+A2) ou SOMME(A1,A2)"); | ||
209 | + formula = in.next(); | ||
210 | + grid.setFormula(column, line, generateFormulaWithString(formula, grid)); | ||
211 | + break; | ||
212 | + case 0: // quitter | ||
213 | + } | ||
214 | + } while (choice != 0); | ||
215 | + } | ||
216 | + | ||
217 | + private static Formula generateFormulaWithString(String input, Grid grid) throws CellNotFoundException, BadSyntaxException { | ||
218 | + Pattern functionPattern = Pattern.compile("([A-Z]+)\\(([A-Z0-9,]+)\\)"); | ||
219 | + Matcher functionMatcher = functionPattern.matcher(input); | ||
220 | + | ||
221 | + if (functionMatcher.matches()) { | ||
222 | + List<Cell> cells = Arrays.stream(functionMatcher.group(2).split(",")) | ||
223 | + .map(c -> grid.getCell(c)) | ||
224 | + .collect(Collectors.toList()); | ||
225 | + | ||
226 | + if (cells.contains(null)) | ||
227 | + throw new CellNotFoundException("Une des cellules demandées n'existe pas."); | ||
247 | 228 | ||
248 | - if (functionMatcher.matches()) { | ||
249 | - List<Cell> cells = Arrays.stream(functionMatcher.group(2).split(",")) | ||
250 | - .map(c -> grid.getCell(c)) | ||
251 | - .collect(Collectors.toList()); | ||
252 | - | ||
253 | - if (cells.contains(null)) | ||
254 | - throw new CellNotFoundException(); | ||
255 | - | ||
256 | - cells = cells.stream().filter(Objects::nonNull).collect(Collectors.toList()); | ||
257 | - | ||
258 | - switch (functionMatcher.group(1)) { | ||
259 | - case "SUM": | ||
260 | - case "SOMME": | ||
261 | - return new Sum(cells); | ||
262 | - case "AVERAGE": | ||
263 | - case "MOYENNE": | ||
264 | - return new Average(cells); | ||
265 | - } | ||
266 | - } else { | ||
267 | - Pattern binaryOperationPattern = Pattern.compile("([A-Z]+[0-9]+)([+\\-*/])([A-Z]+[0-9]+)"); | ||
268 | - Matcher binaryOperationMatcher = binaryOperationPattern.matcher(input); | ||
269 | - | ||
270 | - if (!binaryOperationMatcher.matches()) | ||
271 | - throw new BadSyntaxException(); | ||
272 | - | ||
273 | - Cell leftCell = grid.getCell(binaryOperationMatcher.group(1)); | ||
274 | - Cell rightCell = grid.getCell(binaryOperationMatcher.group(3)); | ||
275 | - | ||
276 | - if (leftCell == null || rightCell == null) | ||
277 | - throw new CellNotFoundException(); | ||
278 | - | ||
279 | - switch (binaryOperationMatcher.group(2)) { | ||
280 | - case "+": | ||
281 | - return new Addition(leftCell, rightCell); | ||
282 | - case "-": | ||
283 | - return new Subtraction(leftCell, rightCell); | ||
284 | - case "*": | ||
285 | - return new Multiplication(leftCell, rightCell); | ||
286 | - case "/": | ||
287 | - return new Division(leftCell, rightCell); | ||
288 | - } | 229 | + cells = cells.stream().filter(Objects::nonNull).collect(Collectors.toList()); |
230 | + | ||
231 | + switch (functionMatcher.group(1)) { | ||
232 | + case "SUM": | ||
233 | + case "SOMME": | ||
234 | + return new Sum(cells); | ||
235 | + case "AVERAGE": | ||
236 | + case "MOYENNE": | ||
237 | + return new Average(cells); | ||
289 | } | 238 | } |
239 | + } else { | ||
240 | + Pattern binaryOperationPattern = Pattern.compile("([A-Z]+[0-9]+)([+\\-*/])([A-Z]+[0-9]+)"); | ||
241 | + Matcher binaryOperationMatcher = binaryOperationPattern.matcher(input); | ||
242 | + | ||
243 | + if (!binaryOperationMatcher.matches()) | ||
244 | + throw new BadSyntaxException(); | ||
245 | + | ||
246 | + Cell leftCell = grid.getCell(binaryOperationMatcher.group(1)); | ||
247 | + Cell rightCell = grid.getCell(binaryOperationMatcher.group(3)); | ||
290 | 248 | ||
291 | - return null; | 249 | + if (leftCell == null || rightCell == null) |
250 | + throw new CellNotFoundException("Une des cellules demandées n'existe pas."); | ||
251 | + | ||
252 | + switch (binaryOperationMatcher.group(2)) { | ||
253 | + case "+": | ||
254 | + return new Addition(leftCell, rightCell); | ||
255 | + case "-": | ||
256 | + return new Subtraction(leftCell, rightCell); | ||
257 | + case "*": | ||
258 | + return new Multiplication(leftCell, rightCell); | ||
259 | + case "/": | ||
260 | + return new Division(leftCell, rightCell); | ||
261 | + } | ||
292 | } | 262 | } |
263 | + | ||
264 | + return null; | ||
265 | + } | ||
293 | 266 | ||
294 | - | ||
295 | -static void myLanguage () { | ||
296 | - | ||
297 | - Scanner in=new Scanner(System.in); | ||
298 | - | ||
299 | - int choix=0; | ||
300 | - System.out.println("\n1: Francais/French\n2: Anglais/English"); | ||
301 | - System.out.println("votre choix? "); | ||
302 | - choix = in.nextInt(); | ||
303 | - switch (choix) { | ||
304 | - case 1 : | ||
305 | - Grid.language=LanguageEnum.FR; | ||
306 | - | ||
307 | - break; | ||
308 | - case 2 : | ||
309 | - Grid.language=LanguageEnum.EN; | ||
310 | - break; | ||
311 | - | ||
312 | - } | ||
313 | -} | ||
314 | - | ||
315 | - | 267 | + private static void myLanguage() { |
268 | + Scanner in = new Scanner(System.in); | ||
269 | + | ||
270 | + int choix = 0; | ||
271 | + | ||
272 | + System.out.println("\n1: Francais/French\n2: Anglais/English"); | ||
273 | + System.out.println("votre choix? "); | ||
274 | + choix = in.nextInt(); | ||
275 | + | ||
276 | + switch (choix) { | ||
277 | + case 1: | ||
278 | + Grid.language = LanguageEnum.FR; | ||
279 | + break; | ||
280 | + case 2: | ||
281 | + Grid.language = LanguageEnum.EN; | ||
282 | + break; | ||
283 | + } | ||
284 | + } | ||
316 | } | 285 | } |
317 | - | ||
318 | - | ||
319 | - |
src/ihm/TablooProto.java
@@ -232,7 +232,7 @@ public class TablooProto extends JPanel { | @@ -232,7 +232,7 @@ public class TablooProto extends JPanel { | ||
232 | .collect(Collectors.toList()); | 232 | .collect(Collectors.toList()); |
233 | 233 | ||
234 | if (cells.contains(null)) | 234 | if (cells.contains(null)) |
235 | - throw new CellNotFoundException(); | 235 | + throw new CellNotFoundException("Une des cellules demandées n'existe pas."); |
236 | 236 | ||
237 | cells = cells.stream().filter(Objects::nonNull).collect(Collectors.toList()); | 237 | cells = cells.stream().filter(Objects::nonNull).collect(Collectors.toList()); |
238 | 238 | ||
@@ -255,7 +255,7 @@ public class TablooProto extends JPanel { | @@ -255,7 +255,7 @@ public class TablooProto extends JPanel { | ||
255 | Cell rightCell = grid.getCell(binaryOperationMatcher.group(3)); | 255 | Cell rightCell = grid.getCell(binaryOperationMatcher.group(3)); |
256 | 256 | ||
257 | if (leftCell == null || rightCell == null) | 257 | if (leftCell == null || rightCell == null) |
258 | - throw new CellNotFoundException(); | 258 | + throw new CellNotFoundException("Une des cellules demandées n'existe pas."); |
259 | 259 | ||
260 | switch (binaryOperationMatcher.group(2)) { | 260 | switch (binaryOperationMatcher.group(2)) { |
261 | case "+": | 261 | case "+": |