added unique error message to invalid format length

This commit is contained in:
Andrin Fassbind 2021-11-12 08:50:03 +01:00
parent 547db94893
commit 8225111671
3 changed files with 4 additions and 5 deletions

View File

@ -166,7 +166,6 @@ public class Text {
/**
* This method counts all Words in text and adds the count together with the paragraph where the word is been used to a Hashmap.
*
* @return HashMap<String, ArrayList < Integer>>
*/
private void createWordlist(HashMap<String,ArrayList<Integer>> wordbook) {
int counter;

View File

@ -62,7 +62,7 @@ public class TextLogik {
if (command.length > 1 && "RAW".equals(command[1])) {
checkIfSuccess(textOutput.formatRaw());
} else if (command.length > 2 && "FIX".equals(command[1]) && isNumeric(command[2])) {
checkIfSuccess(textOutput.formatFix(Integer.parseInt(command[2])));
textOutput.formatFix(Integer.parseInt(command[2]));
} else {
textOutput.errorInvalidCommand();
}

View File

@ -89,14 +89,14 @@ public class TextOutput {
* @param length the paragraph length when printing the text.
* @return returns true if successful and false if and invalid length has been submitted.
*/
public boolean formatFix(int length) {
public void formatFix(int length) {
if(length > 0) {
formatRaw = false;
columnWidth = length;
return true;
userInfoOutput("Command was successfull");
}
else {
return false;
System.err.println("Minimum length has to be greater than 0");
}
}