From 8225111671a55be9a89fdb4bb6c8a852d6cb9d37 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 12 Nov 2021 08:50:03 +0100 Subject: [PATCH] added unique error message to invalid format length --- src/Text.java | 1 - src/TextLogik.java | 2 +- src/TextOutput.java | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Text.java b/src/Text.java index 33274b5..c1391da 100644 --- a/src/Text.java +++ b/src/Text.java @@ -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> */ private void createWordlist(HashMap> wordbook) { int counter; diff --git a/src/TextLogik.java b/src/TextLogik.java index 9bd8f88..376ed96 100644 --- a/src/TextLogik.java +++ b/src/TextLogik.java @@ -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(); } diff --git a/src/TextOutput.java b/src/TextOutput.java index 653e050..0083d52 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -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"); } }