TextLogik sync
This commit is contained in:
parent
86ba50853c
commit
04647a5934
|
@ -12,16 +12,16 @@ public class TextLogik {
|
||||||
textOutput = new TextOutput();
|
textOutput = new TextOutput();
|
||||||
String[] command;
|
String[] command;
|
||||||
|
|
||||||
textOutput.UserInfoOutput("######################");
|
textOutput.userInfoOutput("######################");
|
||||||
textOutput.UserInfoOutput("#WELCOME TO THE EDITOR#");
|
textOutput.userInfoOutput("#WELCOME TO THE EDITOR#");
|
||||||
textOutput.UserInfoOutput("######################");
|
textOutput.userInfoOutput("######################");
|
||||||
do {
|
do {
|
||||||
textOutput.UserInfoOutput("Please enter a Command: ");
|
textOutput.userInfoOutput("Please enter a Command: ");
|
||||||
command = TextInput.checkForInput();
|
command = TextInput.checkForInput();
|
||||||
|
|
||||||
switch (command[0]) {
|
switch (command[0]) {
|
||||||
case "ADD":
|
case "ADD":
|
||||||
textOutput.UserInfoOutput("Please enter your text: ");
|
textOutput.userInfoOutput("Please enter your text: ");
|
||||||
if (command.length == 1) {
|
if (command.length == 1) {
|
||||||
checkIfSuccess(text.add(TextInput.getTextInput()));
|
checkIfSuccess(text.add(TextInput.getTextInput()));
|
||||||
} else if (isNumeric(command[1])) {
|
} else if (isNumeric(command[1])) {
|
||||||
|
@ -65,13 +65,13 @@ public class TextLogik {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "INDEX":
|
case "INDEX":
|
||||||
textOutput.IndexOutput(text.index());
|
textOutput.indexOutput(text.index());
|
||||||
break;
|
break;
|
||||||
case "PRINT":
|
case "PRINT":
|
||||||
textOutput.print(text.getText());
|
textOutput.print(text.getText());
|
||||||
break;
|
break;
|
||||||
case "REPLACE":
|
case "REPLACE":
|
||||||
textOutput.UserInfoOutput("Please enter your text to replace: ");
|
textOutput.userInfoOutput("Please enter your text to replace: ");
|
||||||
if (command.length == 1){
|
if (command.length == 1){
|
||||||
checkIfSuccess(text.replace(TextInput.getTextInput(), TextInput.getTextInput()));
|
checkIfSuccess(text.replace(TextInput.getTextInput(), TextInput.getTextInput()));
|
||||||
}else if(isNumeric(command[1])) {
|
}else if(isNumeric(command[1])) {
|
||||||
|
@ -102,7 +102,7 @@ public class TextLogik {
|
||||||
|
|
||||||
private void checkIfSuccess(boolean method) {
|
private void checkIfSuccess(boolean method) {
|
||||||
if(method) {
|
if(method) {
|
||||||
textOutput.UserInfoOutput("Command was successfull");
|
textOutput.userInfoOutput("Command was successfull");
|
||||||
}else {
|
}else {
|
||||||
textOutput.errorInvalidParagraph();
|
textOutput.errorInvalidParagraph();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue