changes in TextLogik.java

This commit is contained in:
schrom01 2021-11-11 14:42:44 +01:00
parent 2890840817
commit b0622643d4
1 changed files with 10 additions and 3 deletions

View File

@ -18,10 +18,10 @@ public class TextLogik {
switch (command[0]) { switch (command[0]) {
case "ADD": case "ADD":
if (command.length == 1) { if (command.length == 1) {
text.add(TextInput.getTextInput()); checkIfSuccess(text.add(TextInput.getTextInput()));
} else if (isNumeric(command[1])) { } else if (isNumeric(command[1])) {
int line = Integer.parseInt(command[1]); int line = Integer.parseInt(command[1]);
text.add(line, TextInput.getTextInput()); checkIfSuccess(text.add(line, TextInput.getTextInput()));
} else { } else {
textOutput.errorInvalidCommand(); textOutput.errorInvalidCommand();
} }
@ -38,7 +38,14 @@ public class TextLogik {
} }
break; break;
case "DUMMY": case "DUMMY":
text.dummy(); if (command.length == 1) {
checkIfSuccess(text.dummy());
} else if (isNumeric(command[1])) {
int line = Integer.parseInt(command[1]);
checkIfSuccess(text.dummy(line));
} else {
textOutput.errorInvalidCommand();
}
break; break;
case "EXIT": case "EXIT":
break; break;