From ac061e5085b753d17ffb2d368dbac7d71bee3c43 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Thu, 11 Nov 2021 14:05:05 +0100 Subject: [PATCH] TextLogik default changed --- docs/PM2_ClassDiagram.drawio | 2 +- src/Text.java | 12 +++++------- src/TextLogik.java | 2 +- src/TextOutput.java | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/PM2_ClassDiagram.drawio b/docs/PM2_ClassDiagram.drawio index a8aea87..f552812 100644 --- a/docs/PM2_ClassDiagram.drawio +++ b/docs/PM2_ClassDiagram.drawio @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Text.java b/src/Text.java index df06b53..108d703 100644 --- a/src/Text.java +++ b/src/Text.java @@ -104,11 +104,9 @@ public class Text { * This method deletes a specific Paragraph. As a Parameter it uses a int. * If the Parameter is valid it deletes the specific Pararaph otherwise returns false * - * @param paragraphNumber - * @return False: If the int is not a valid paragraph. - * @return True: If the int is a valid paragraph number + * @param paragraphNumber the Paragraph which should be deleted. + * @return False: If the int is not a valid paragraph. || True: If the int is a valid paragraph number */ - public boolean del(int paragraphNumber) { if (paragraphExists(paragraphNumber)) { text.remove(paragraphNumber - 1); @@ -135,7 +133,8 @@ public class Text { * @return ArrayList */ public ArrayList index() { - HashMap> wordbook = createWordlist(); + HashMap> wordbook = new HashMap<>(); + wordbook = createWordlist(wordbook); String input; ArrayList output = new ArrayList<>(); ArrayList values; @@ -163,8 +162,7 @@ public class Text { * * @return HashMap> */ - private HashMap> createWordlist() { - HashMap> wordbook = new HashMap<>(); + private HashMap> createWordlist(HashMap> wordbook) { int counter; ArrayList numbersList; String firstLetter; diff --git a/src/TextLogik.java b/src/TextLogik.java index 4038762..a4b8319 100644 --- a/src/TextLogik.java +++ b/src/TextLogik.java @@ -77,7 +77,7 @@ public class TextLogik { break; default: - System.out.println("Command not found. Try again"); + textOutput.errorInvalidCommand(); break; } diff --git a/src/TextOutput.java b/src/TextOutput.java index d3015c2..d51c885 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -127,7 +127,7 @@ public class TextOutput { /** * Method to give out the Error "Invalid String". */ - public void errorInvalidString() { + public void errorInvalidInput() { System.err.println("Invalid String"); }