From 4cfea4a1fd54fa63699735a79b6aeb195e02d967 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 12 Nov 2021 09:19:49 +0100 Subject: [PATCH 01/21] added new line after each paragraph. --- docs/PM2_ClassDiagram.drawio | 2 +- src/TextOutput.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/PM2_ClassDiagram.drawio b/docs/PM2_ClassDiagram.drawio index 3c57fb8..e7ab7d1 100644 --- a/docs/PM2_ClassDiagram.drawio +++ b/docs/PM2_ClassDiagram.drawio @@ -1 +1 @@ - \ No newline at end of file +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 \ No newline at end of file diff --git a/src/TextOutput.java b/src/TextOutput.java index 0083d52..6b7d018 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -69,6 +69,7 @@ public class TextOutput { System.out.println(); } } + System.out.println(); } } From b184dc9cbb79c2c09bdeac71194555c32a1099dc Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 09:51:37 +0100 Subject: [PATCH 02/21] changes in README.md --- README.md | 29 ++++++++++++++++------------- src/Text.java | 1 - 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bca003d..5686d60 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,49 @@ #Texteditor Texteditor is a program to edit a text by in- and output into the console. #Usermanual -#ADD a Textline +#ADD a paragraph ```ADD``` -First please enter the command add to add a new textline. Then enter the text you want to add . +First please enter the command add to add a new paragraph at the end of text. Then enter the text you want to add . ```ADD [n]``` -If you want to add a textline to a certain paragraph then please use the command add and then enter that paragraphnummber. +If you want to add a paragraph between existing paragraphs then please use the command add and then enter the paragraphnumber it should get. After that enter the text you want to add to that paragraph. #DUMMY Text ```DUMMY``` -First please enter the command dummy to enter a pre written text into the textline. +First please enter the command dummy to enter a pre written paragraph into the text. ```DUMMY [n]``` -If you want to enter a pre written dummy text into a specific paragraph then please enter the command dummy and then the paragraph that you want to use. +If you want to enter a pre written dummy paragraph between existing paragraphs then please enter the command dummy and then enter the paragraphnumber it should get. #REPLACE a Text ```REPLACE``` First please enter the command replace then enter the characters that you want to replace. After that please enter -the new characters that should replace the old characters. +the new characters that should replace the old characters. If don't enter a paragraphnumber, the change will be made in the last paragraph. ```REPLACE [n]``` -If you want to replace a text from a certain paragraph, please enter the command replace and then enter the characters you want to +If you want to replace a text from a specific paragraph, please enter the command and the paragraphnumber and then enter the characters you want to replace. After you entered the characters you want to replace please enter now the new characters that should replace the old characters. #DELETE a Text ```DEL``` -First please enter the command del to delete a text. Then please enter the text size you want to delete. +First please enter the command del to delete the last paragraph. ```DEL [n]``` -If you want to delete a text from a certain paragraph then please enter the command del and then the paragraph that you want to delete. +If you want to delete a specific paragraph then please enter the command del and then the paragraph you want to delete. #INDEX -``ÌNDEX`` -First please enter the command index to show the index. +```INDEX``` +Please enter the command index to show the index. #Print the Text ```PRINT``` -First please enter the command print to print out the current text you have. +Please enter the command print to print out the current text you have. To change the output format, use the commands ```FORMAT FIX``` and ```FORMAT RAW``` #FORMAT the Text -```FORMAT``` +```FORMAT RAW``` +Please enter the command format raw to change the print format to raw. After you changed the format to raw, each paragraph will be printed on one line with it's paragraph number. +```FORMAT FIX [n]``` +Please enter the command foramt fix and the line length which should be used. After you changed the format to fix, the defined line length will be used to print the text. diff --git a/src/Text.java b/src/Text.java index 21a3df7..9ad2f2e 100644 --- a/src/Text.java +++ b/src/Text.java @@ -198,5 +198,4 @@ public class Text { } } } - } From 7f448bb89464518a1a36f7acff79e50deec9289a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 09:54:42 +0100 Subject: [PATCH 03/21] changes in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5686d60..e20b07a 100644 --- a/README.md +++ b/README.md @@ -46,4 +46,4 @@ Please enter the command print to print out the current text you have. To change Please enter the command format raw to change the print format to raw. After you changed the format to raw, each paragraph will be printed on one line with it's paragraph number. ```FORMAT FIX [n]``` -Please enter the command foramt fix and the line length which should be used. After you changed the format to fix, the defined line length will be used to print the text. +Please enter the command format fix and the line length which should be used. After you changed the format to fix, the defined line length will be used to print the text. From 0310b7854097f9aa2c1e172fc65dbd99bdb0a063 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 10:06:21 +0100 Subject: [PATCH 04/21] changes in classdiagramm --- docs/PM2_ClassDiagram.drawio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/PM2_ClassDiagram.drawio b/docs/PM2_ClassDiagram.drawio index e7ab7d1..f70d9d4 100644 --- a/docs/PM2_ClassDiagram.drawio +++ b/docs/PM2_ClassDiagram.drawio @@ -1 +1 @@ -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 \ No newline at end of file + \ No newline at end of file From 32cb472310bcf5bee5299cb13eec9ccc41b1f5e3 Mon Sep 17 00:00:00 2001 From: amadoste Date: Fri, 12 Nov 2021 10:21:21 +0100 Subject: [PATCH 05/21] Corrections to Javadocs have been made. Changes in method toFormat. --- docs/PM2_ClassDiagram.drawio | 2 +- src/Text.java | 19 ++++++++++++----- src/TextEditor.java | 10 +++++++-- src/TextInput.java | 19 +++++++++++++++++ src/{TextLogik.java => TextLogic.java} | 16 +++++++++++--- src/TextOutput.java | 29 +++++++++++--------------- 6 files changed, 67 insertions(+), 28 deletions(-) rename src/{TextLogik.java => TextLogic.java} (91%) diff --git a/docs/PM2_ClassDiagram.drawio b/docs/PM2_ClassDiagram.drawio index 3c57fb8..bab77fe 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 21a3df7..dc0bbdb 100644 --- a/src/Text.java +++ b/src/Text.java @@ -2,8 +2,17 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +/** + * New class Text + * This class saves and edits the text. + * Authors: Roman Schenk, Andrin Fassbind + * Date: 12.11.2021 + */ public class Text { + /** + * The DataFields text and dummyText save the objects that are being used in this class. + */ private final ArrayList text = new ArrayList<>(); private static final String dummyText = "The standard Lorem Ipsum passage, used since the 1500s \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\" Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"; @@ -89,11 +98,11 @@ public class Text { } /** - * Method to replace characters in the last paragraph + * Method to replace characters in the last paragraph. * * @param oldChar the old character. * @param newChar the new character. - * @return returns true if the paragraph is changed successfully + * @return returns true if the paragraph is changed successfully. */ public boolean replace(String oldChar, String newChar) { if(paragraphExists(text.size())) { @@ -104,11 +113,11 @@ public class Text { } /** - * This method deletes a specific paragraph. As a parameter it uses a int. + * This method deletes a specific paragraph. As a parameter it uses an int. * If the parameter is valid it deletes the specific pararaph otherwise it will return false. * - * @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 + * @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)) { diff --git a/src/TextEditor.java b/src/TextEditor.java index 9839adb..e296352 100644 --- a/src/TextEditor.java +++ b/src/TextEditor.java @@ -1,12 +1,18 @@ +/** + * New class TextEditor + * This class contains the main method. + * Author: Michael Ziegler + * Date: 12.11.2021 + */ public class TextEditor { /** * Main Method that is connected to the TextLogik class. + * * @param args there are no arguments needed. */ - public static void main(String[] args) { - TextLogik t = new TextLogik(); + TextLogic t = new TextLogic(); } diff --git a/src/TextInput.java b/src/TextInput.java index f7f68d9..2d63271 100644 --- a/src/TextInput.java +++ b/src/TextInput.java @@ -1,13 +1,32 @@ import java.util.Scanner; +/** + * New class TextInput + * This class checks for new command inputs and gets the text input. + * Author: Michael Ziegler + * Date: 12.11.2021 + */ public class TextInput { + /** + * DataField Scanner saves the object that is being used in this class. + */ private static final Scanner sc = new Scanner(System.in); + /** + * Method to check for new input. + * + * @return the StringArray with the commands. + */ public static String[] checkForInput() { return sc.nextLine().toUpperCase().split(" "); } + /** + * Gets the text that has been written. + * + * @return the next line. + */ public static String getTextInput() { return sc.nextLine(); } diff --git a/src/TextLogik.java b/src/TextLogic.java similarity index 91% rename from src/TextLogik.java rename to src/TextLogic.java index 376ed96..9205b27 100644 --- a/src/TextLogik.java +++ b/src/TextLogic.java @@ -1,13 +1,23 @@ -public class TextLogik { +/** + * New class TextLogic + * This class defines the commands and initiates the methods of the Text class and TextOutput class. + * Authors: Michael Ziegler, Stefan Amador + * Date: 12.11.2021 + */ +public class TextLogic { + + /** + * The DataFields text and textOutput save the objects that are being used later in this class. + */ private final Text text; private final TextOutput textOutput; /** - * Initiates a new instance of the class TextLogik. + * Initiates a new instance of the class TextLogic. * Contains command instructions for the class Text. * Defined the different cases and appointed to specific commands. */ - public TextLogik() { + public TextLogic() { text = new Text(); textOutput = new TextOutput(); String[] command; diff --git a/src/TextOutput.java b/src/TextOutput.java index 0083d52..fdfaccb 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -1,14 +1,17 @@ import java.util.ArrayList; /** - * + * New class TextOutput + * This class puts out the finished text and formats the text if wanted. + * Author: Leonardo Brandenberger + * Date: 12.11.2021 */ public class TextOutput { private boolean formatRaw; private int columnWidth = 20; /** - * Method which checks in which way the paragraphs should be displayed. And then calls the corresponding + * Method that checks in which way the paragraphs should be displayed and then calls the corresponding * method to output the text as desired. * * @param text the ArrayList which is then formatted into the desired output. @@ -33,7 +36,6 @@ public class TextOutput { for (int counter = 0; counter < text.size(); counter++) { System.out.println("<" + (counter + 1) + ">: <" + text.get(counter) + ">"); } - } /** @@ -50,22 +52,16 @@ public class TextOutput { int currentWordNumber = 0; for(String word : words) { currentWordNumber++; - if (word.length()<= columnWidth - currentLength) { - System.out.print(word); + if (word.length()>= columnWidth - currentLength && currentWordNumber != 1) { + System.out.println(); + currentLength = 0; } - else { - if(currentWordNumber != 1) { - System.out.println(); - currentLength = 0; - } - System.out.print(word); + System.out.print(word); - } if(!(currentWordNumber == lastWordNumber)) { System.out.print(" "); currentLength = currentLength + word.length() + 1; - } - else { + } else { System.out.println(); } } @@ -83,17 +79,16 @@ public class TextOutput { } /** - * Method to set the formatRaw to false and also set the length of the desired paragraph length in order to limit + * Method to set the formatRaw to false and also to set the length of the desired paragraph length in order to limit * the paragraph length when printing the text. * * @param length the paragraph length when printing the text. - * @return returns true if successful and false if and invalid length has been submitted. */ public void formatFix(int length) { if(length > 0) { formatRaw = false; columnWidth = length; - userInfoOutput("Command was successfull"); + userInfoOutput("Command was successful"); } else { System.err.println("Minimum length has to be greater than 0"); From c76c35a62cf7261340a72c6dfcc6d873d52c1fc2 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 10:27:41 +0100 Subject: [PATCH 06/21] changes in classdiagramm --- docs/PM2_ClassDiagram.drawio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/PM2_ClassDiagram.drawio b/docs/PM2_ClassDiagram.drawio index f70d9d4..72c4b65 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 From 274836ae5a12b502d11332a07ae515c77180b845 Mon Sep 17 00:00:00 2001 From: amadoste Date: Fri, 12 Nov 2021 10:32:48 +0100 Subject: [PATCH 07/21] Change to README file and deleted TextInputTest file. --- README.md | 2 +- test/TextInputTest.java | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 test/TextInputTest.java diff --git a/README.md b/README.md index e20b07a..7025fc0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ If you want to delete a specific paragraph then please enter the command del and ```INDEX``` Please enter the command index to show the index. -#Print the Text +#PRINT the Text ```PRINT``` Please enter the command print to print out the current text you have. To change the output format, use the commands ```FORMAT FIX``` and ```FORMAT RAW``` diff --git a/test/TextInputTest.java b/test/TextInputTest.java deleted file mode 100644 index 10c5df2..0000000 --- a/test/TextInputTest.java +++ /dev/null @@ -1,10 +0,0 @@ -import org.junit.jupiter.api.Test; - -class TextInputTest { - - @Test - public void inputTest() { - - } - -} \ No newline at end of file From b8b3d78b78f219e9fbda309728f19863e60ce4f5 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 10:37:38 +0100 Subject: [PATCH 08/21] reformating code --- README.md | 59 +++++++++++++++++++++++++--------------- docs/Equivalent.md | 2 +- docs/Pflichtenheft.md | 59 ++++++++++++++++++++++++++++------------ src/Text.java | 13 ++++----- src/TextLogic.java | 2 +- src/TextOutput.java | 21 ++++++-------- test/TextOutputTest.java | 1 - test/TextTest.java | 10 +++---- 8 files changed, 100 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index e20b07a..1405ce4 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,64 @@ -#Texteditor +# Texteditor + Texteditor is a program to edit a text by in- and output into the console. -#Usermanual -#ADD a paragraph + +# Usermanual + +# ADD a paragraph + ```ADD``` -First please enter the command add to add a new paragraph at the end of text. Then enter the text you want to add . +First please enter the command add to add a new paragraph at the end of text. Then enter the text you want to add . ```ADD [n]``` -If you want to add a paragraph between existing paragraphs then please use the command add and then enter the paragraphnumber it should get. -After that enter the text you want to add to that paragraph. +If you want to add a paragraph between existing paragraphs then please use the command add and then enter the +paragraphnumber it should get. After that enter the text you want to add to that paragraph. + +# DUMMY Text -#DUMMY Text ```DUMMY``` First please enter the command dummy to enter a pre written paragraph into the text. ```DUMMY [n]``` -If you want to enter a pre written dummy paragraph between existing paragraphs then please enter the command dummy and then enter the paragraphnumber it should get. +If you want to enter a pre written dummy paragraph between existing paragraphs then please enter the command dummy and +then enter the paragraphnumber it should get. + +# REPLACE a Text -#REPLACE a Text ```REPLACE``` -First please enter the command replace then enter the characters that you want to replace. After that please enter -the new characters that should replace the old characters. If don't enter a paragraphnumber, the change will be made in the last paragraph. +First please enter the command replace then enter the characters that you want to replace. After that please enter the +new characters that should replace the old characters. If don't enter a paragraphnumber, the change will be made in the +last paragraph. ```REPLACE [n]``` -If you want to replace a text from a specific paragraph, please enter the command and the paragraphnumber and then enter the characters you want to -replace. After you entered the characters you want to replace please enter now the new characters that should replace the -old characters. +If you want to replace a text from a specific paragraph, please enter the command and the paragraphnumber and then enter +the characters you want to replace. After you entered the characters you want to replace please enter now the new +characters that should replace the old characters. + +# DELETE a Text -#DELETE a Text ```DEL``` First please enter the command del to delete the last paragraph. ```DEL [n]``` If you want to delete a specific paragraph then please enter the command del and then the paragraph you want to delete. -#INDEX +# INDEX + ```INDEX``` Please enter the command index to show the index. -#Print the Text -```PRINT``` -Please enter the command print to print out the current text you have. To change the output format, use the commands ```FORMAT FIX``` and ```FORMAT RAW``` +# Print the Text + +```PRINT``` +Please enter the command print to print out the current text you have. To change the output format, use the +commands ```FORMAT FIX``` and ```FORMAT RAW``` + +# FORMAT the Text -#FORMAT the Text ```FORMAT RAW``` -Please enter the command format raw to change the print format to raw. After you changed the format to raw, each paragraph will be printed on one line with it's paragraph number. +Please enter the command format raw to change the print format to raw. After you changed the format to raw, each +paragraph will be printed on one line with it's paragraph number. ```FORMAT FIX [n]``` -Please enter the command format fix and the line length which should be used. After you changed the format to fix, the defined line length will be used to print the text. +Please enter the command format fix and the line length which should be used. After you changed the format to fix, the +defined line length will be used to print the text. diff --git a/docs/Equivalent.md b/docs/Equivalent.md index 83f7ba7..0843df2 100644 --- a/docs/Equivalent.md +++ b/docs/Equivalent.md @@ -1,4 +1,4 @@ -#Equivalent +# Equivalent ### Text.java Index method diff --git a/docs/Pflichtenheft.md b/docs/Pflichtenheft.md index 7ef16b0..db2d0d7 100644 --- a/docs/Pflichtenheft.md +++ b/docs/Pflichtenheft.md @@ -2,7 +2,8 @@ ## Aufgabe -Programmieren Sie eine einfache Textverarbeitung mit Ein- und Ausgabe über die Konsole. Diese soll als eigenständige Anwendung laufen und über den folgenden Befehlssatz gesteuert werden: +Programmieren Sie eine einfache Textverarbeitung mit Ein- und Ausgabe über die Konsole. Diese soll als eigenständige +Anwendung laufen und über den folgenden Befehlssatz gesteuert werden: | Befehl | Beschreibung | | :--- | :--- | @@ -19,19 +20,29 @@ Programmieren Sie eine einfache Textverarbeitung mit Ein- und Ausgabe über die ## Anforderungen - Ihre Anwendung muss eigenständig laufen, also durch Aufruf von main() und ohne BlueJ. -- Schreiben Sie Rückmeldungen zu Fehlern (z.B. «Unbekanntes Kommando») statt auf die Standardausgabe (System.out) auf die Standardfehlerausgabe (Sytem.err). Die Syntax ist analog zu der von System.out bekannten ("System.err.println"). -- Sie dürfen alle in der Vorlesung bis zur Abgabe durchgenommenen Konstrukte benutzen, jedoch nur diese. Dies schliesst insbesondere ein: Allen Stoff im BlueJ-Buch bis und mit Kapitel 9, JUnit Testing, Packages zur Verwaltung Ihres Codes. Es schliesst insbesondere aus: Vererbung, Einbindung von Paketen ausserhalb java.util.* -- Als "Absatz" definieren wir eine über die unten beschriebene Scanner.nextline() - Methode eingelesenen String. Validieren Sie den erhaltenen Input und filtern Sie alle Sonderzeichen (d.h. der in die Anwendung übernommene Text darf nur Buchstaben, Zahlen, Leerzeichen und Satzzeichen enthalten). +- Schreiben Sie Rückmeldungen zu Fehlern (z.B. «Unbekanntes Kommando») statt auf die Standardausgabe (System.out) auf + die Standardfehlerausgabe (Sytem.err). Die Syntax ist analog zu der von System.out bekannten ("System.err.println"). +- Sie dürfen alle in der Vorlesung bis zur Abgabe durchgenommenen Konstrukte benutzen, jedoch nur diese. Dies schliesst + insbesondere ein: Allen Stoff im BlueJ-Buch bis und mit Kapitel 9, JUnit Testing, Packages zur Verwaltung Ihres Codes. + Es schliesst insbesondere aus: Vererbung, Einbindung von Paketen ausserhalb java.util.* +- Als "Absatz" definieren wir eine über die unten beschriebene Scanner.nextline() - Methode eingelesenen String. + Validieren Sie den erhaltenen Input und filtern Sie alle Sonderzeichen (d.h. der in die Anwendung übernommene Text + darf nur Buchstaben, Zahlen, Leerzeichen und Satzzeichen enthalten). - Das Einlesen und Abspeichern von Dateien ist in diesem Projekt nicht notwendig. -- Ihr Code ist in Javadoc (mindestens für Klassen und Public Methods und zusätzlich für Konstruktoren, jedoch generell ohne Getter/Setter) und wo sinnvoll in Zeilenkommentaren zur Funktionalität dokumentiert. Ihr Klassendiagramm ist auf GitHub abgelegt. Die zur Übersetzung und Start nötigen Aufrufe sind separat im README für Ihr Repo dokumentiert. -- Definieren Sie Unit Tests für die Index-Funktionalität, implementieren Sie diese in JUnit und führen Sie sie aus. Dokumentieren Sie die Tests. +- Ihr Code ist in Javadoc (mindestens für Klassen und Public Methods und zusätzlich für Konstruktoren, jedoch generell + ohne Getter/Setter) und wo sinnvoll in Zeilenkommentaren zur Funktionalität dokumentiert. Ihr Klassendiagramm ist auf + GitHub abgelegt. Die zur Übersetzung und Start nötigen Aufrufe sind separat im README für Ihr Repo dokumentiert. +- Definieren Sie Unit Tests für die Index-Funktionalität, implementieren Sie diese in JUnit und führen Sie sie aus. + Dokumentieren Sie die Tests. - Wenden Sie die relevanten Abschnitte im Clean-Code-Handbuch an. ## Hinweise - Achten Sie beim Klassenentwurf auf Kohäsion und Kopplung und beachten Sie auch die Hinweise im Clean-Code-Handbuch. -- Fehlervermeidung und JUnit wird in Programmieren 1 durchgenommen. Planen Sie genügend Zeit ein, um Ihre Tests zu definieren, umzusetzen und allfällige Fehler zu korrigieren. -- Für Management und Dokumentation von Arbeitsschritten empfehlen wir das Issue Tracking in GitHub. Andere Lösungen sind denkbar. +- Fehlervermeidung und JUnit wird in Programmieren 1 durchgenommen. Planen Sie genügend Zeit ein, um Ihre Tests zu + definieren, umzusetzen und allfällige Fehler zu korrigieren. +- Für Management und Dokumentation von Arbeitsschritten empfehlen wir das Issue Tracking in GitHub. Andere Lösungen sind + denkbar. - Eine Quelle für Blindtext ist https://lipsum.com/. Andere Texte sind möglich. ## Vorgehen @@ -48,7 +59,9 @@ Wir empfehlen, etwa folgendermassen vorzugehen: ## Abgabe -Legen Sie für das Projekt ein Repository gemäss der bereits aus Projekt 1 bekannten Anleitung an. Der von Ihnen erarbeitete Code muss zur Abgabe bis zur bekanntgegebenen Deadline dort hochgeladen werden. Abgaben auf anderen Services (github.com, OneDrive, etc.) werden nicht gewertet. +Legen Sie für das Projekt ein Repository gemäss der bereits aus Projekt 1 bekannten Anleitung an. Der von Ihnen +erarbeitete Code muss zur Abgabe bis zur bekanntgegebenen Deadline dort hochgeladen werden. Abgaben auf anderen +Services (github.com, OneDrive, etc.) werden nicht gewertet. ## Bewertung @@ -56,24 +69,32 @@ Für diese Aufgabe erhalten Sie maximal 15 Punkte. In die Bewertung fliessen fol ### Allgemeine Anforderung (all-or-nothing) -- Voraussetzung für Punkterteilung: Das Programm ist lauffähig. (Kriterium: Vorführung oder Test durch Ihre Dozierenden) Ein nicht lauffähiges Programm erhält 0 Punkte. - Ein lauffähiges Programm wird in den folgenden beiden Bereichen beurteilt. Für Teil- oder Nichterfüllung werden Abzüge in Ansatz gebracht. Das Nichterfüllen einer Unterkategorie kann zum vollständigen Abzug in einem Bereich führen. Es werden keine Negativpunkte vergeben. - +- Voraussetzung für Punkterteilung: Das Programm ist lauffähig. (Kriterium: Vorführung oder Test durch Ihre Dozierenden) + Ein nicht lauffähiges Programm erhält 0 Punkte. Ein lauffähiges Programm wird in den folgenden beiden Bereichen + beurteilt. Für Teil- oder Nichterfüllung werden Abzüge in Ansatz gebracht. Das Nichterfüllen einer Unterkategorie kann + zum vollständigen Abzug in einem Bereich führen. Es werden keine Negativpunkte vergeben. ### Bereich Entwicklung - Ihr Programm besitzt die geforderte Funktionalität. (Vorführung oder Test durch Ihre Dozierenden) -- Sie halten die Vorgaben hinsichtlich einsetzbarer Konstrukte und Clean Code ein. (Codeanalyse durch Ihre Dozierenden, ggf. Erläuterung) -- Sie haben eine gute Klassenaufteilung gefunden. Das Klassendiagramm ist auf GitHub mit hochzuladen. (Analyse durch Ihre Dozierenden, ggf. Erläuterung) -- Sie haben sinnvolle Test Cases für die Funktion Index definiert, diese in JUnit umgesetzt und erfolgreich ausgeführt. (Dokumentation über Test Cases und erfolgreiche Tests, diese sind auf GitHub mit hochzuladen.) +- Sie halten die Vorgaben hinsichtlich einsetzbarer Konstrukte und Clean Code ein. (Codeanalyse durch Ihre Dozierenden, + ggf. Erläuterung) +- Sie haben eine gute Klassenaufteilung gefunden. Das Klassendiagramm ist auf GitHub mit hochzuladen. (Analyse durch + Ihre Dozierenden, ggf. Erläuterung) +- Sie haben sinnvolle Test Cases für die Funktion Index definiert, diese in JUnit umgesetzt und erfolgreich + ausgeführt. (Dokumentation über Test Cases und erfolgreiche Tests, diese sind auf GitHub mit hochzuladen.) ### Bereich Vorgehen und Dokumentation - Ihr Code ist mit JavaDoc dokumentiert. (s.a. Hinweis unter "Anforderungen", Analyse durch Ihre Dozierenden) -- Alle Gruppenmitglieder haben in nennenswertem Umfang Code beigetragen und auf GitHub eingecheckt. (Check durch GitHub Log) +- Alle Gruppenmitglieder haben in nennenswertem Umfang Code beigetragen und auf GitHub eingecheckt. (Check durch GitHub + Log) ## Beispielcode zum Konsoleneingabe -Die Eingabe von Text ist im BlueJ-Buch, Kapitel 6 erwähnt und in Kapitel 14.9. genauer beschrieben. Wenn Sie Probleme bei der Anwendung der Texteingabe haben, wenden Sie sich an Ihre Dozierenden. Die Anwendung der Scanner-Klasse sollte nach dem gegebenen Muster jedoch einfach gelingen. + +Die Eingabe von Text ist im BlueJ-Buch, Kapitel 6 erwähnt und in Kapitel 14.9. genauer beschrieben. Wenn Sie Probleme +bei der Anwendung der Texteingabe haben, wenden Sie sich an Ihre Dozierenden. Die Anwendung der Scanner-Klasse sollte +nach dem gegebenen Muster jedoch einfach gelingen. In der Grundfunktionalität sieht sie folgendermassen aus: @@ -115,4 +136,6 @@ public class InputReaderMod { } ``` -**Quelle**: Anpassung von InputReader.java (englischsprachige Fassung der im Buch in Kap. 6 erwähnten Klasse EingabeLeser.java) aus dem Unterverzeichnis projects/chapter06/ tech-support-complete im Archiv https://bluej.org/objects-first/resources/projects.zip) +**Quelle**: Anpassung von InputReader.java (englischsprachige Fassung der im Buch in Kap. 6 erwähnten Klasse +EingabeLeser.java) aus dem Unterverzeichnis projects/chapter06/ tech-support-complete im +Archiv https://bluej.org/objects-first/resources/projects.zip) diff --git a/src/Text.java b/src/Text.java index d0daaaf..2ca4077 100644 --- a/src/Text.java +++ b/src/Text.java @@ -10,11 +10,11 @@ import java.util.Map; */ public class Text { + private static final String dummyText = "The standard Lorem Ipsum passage, used since the 1500s \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\" Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"; /** * The DataFields text and dummyText save the objects that are being used in this class. */ private final ArrayList text = new ArrayList<>(); - private static final String dummyText = "The standard Lorem Ipsum passage, used since the 1500s \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\" Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"; /** * Method to check if a specific paragraph exists. @@ -48,7 +48,7 @@ public class Text { * @return returns true if the paragraph is added successfully. */ public boolean add(String text) { - this.text.add(text.replaceAll("[^A-Za-z0-9 .,:?!\"'-]","")); + this.text.add(text.replaceAll("[^A-Za-z0-9 .,:?!\"'-]", "")); return true; } @@ -105,7 +105,7 @@ public class Text { * @return returns true if the paragraph is changed successfully. */ public boolean replace(String oldChar, String newChar) { - if(paragraphExists(text.size())) { + if (paragraphExists(text.size())) { text.set((text.size() - 1), text.get(text.size() - 1).replace(oldChar, newChar)); return true; } @@ -133,7 +133,7 @@ public class Text { * @return True: if paragraph has been deleted. */ public boolean del() { - if(paragraphExists(text.size())){ + if (paragraphExists(text.size())) { text.remove(text.size() - 1); return true; } @@ -148,7 +148,7 @@ public class Text { * @return ArrayList */ public ArrayList index() { - HashMap> wordbook = new HashMap<>(); + HashMap> wordbook = new HashMap<>(); createWordlist(wordbook); String input; ArrayList output = new ArrayList<>(); @@ -174,9 +174,8 @@ public class Text { /** * This method counts all words in text and adds the count together with the paragraph where the word has been used to a Hashmap. - * */ - private void createWordlist(HashMap> wordbook) { + private void createWordlist(HashMap> wordbook) { int counter; ArrayList numbersList; String firstLetter; diff --git a/src/TextLogic.java b/src/TextLogic.java index 9205b27..f3feb4e 100644 --- a/src/TextLogic.java +++ b/src/TextLogic.java @@ -32,7 +32,7 @@ public class TextLogic { switch (command[0]) { case "ADD": String inputText = ""; - while(inputText.length() == 0) { + while (inputText.length() == 0) { textOutput.userInfoOutput("Please enter your text: "); inputText = TextInput.getTextInput(); } diff --git a/src/TextOutput.java b/src/TextOutput.java index 625abb8..16d577a 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -17,10 +17,9 @@ public class TextOutput { * @param text the ArrayList which is then formatted into the desired output. */ public void print(ArrayList text) { - if(text.size() == 0) { + if (text.size() == 0) { errorMissingText(); - } - else if (formatRaw) { + } else if (formatRaw) { printFormated(text); } else { toFormat(text); @@ -50,15 +49,15 @@ public class TextOutput { String[] words = paragraph.split(" "); int lastWordNumber = words.length; int currentWordNumber = 0; - for(String word : words) { + for (String word : words) { currentWordNumber++; - if (word.length()>= columnWidth - currentLength && currentWordNumber != 1) { + if (word.length() >= columnWidth - currentLength && currentWordNumber != 1) { System.out.println(); currentLength = 0; } System.out.print(word); - if(!(currentWordNumber == lastWordNumber)) { + if (!(currentWordNumber == lastWordNumber)) { System.out.print(" "); currentLength = currentLength + word.length() + 1; } else { @@ -86,12 +85,11 @@ public class TextOutput { * @param length the paragraph length when printing the text. */ public void formatFix(int length) { - if(length > 0) { + if (length > 0) { formatRaw = false; columnWidth = length; userInfoOutput("Command was successful"); - } - else { + } else { System.err.println("Minimum length has to be greater than 0"); } } @@ -111,10 +109,9 @@ public class TextOutput { * @param index ArrayList with words and in which part they have */ public void indexOutput(ArrayList index) { - if(index.size() == 0) { + if (index.size() == 0) { userInfoOutput("index empty"); - } - else { + } else { for (String word : index) { System.out.println(word); } diff --git a/test/TextOutputTest.java b/test/TextOutputTest.java index 17d72b9..a066f71 100644 --- a/test/TextOutputTest.java +++ b/test/TextOutputTest.java @@ -1,7 +1,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import java.util.ArrayList; class TextOutputTest { diff --git a/test/TextTest.java b/test/TextTest.java index 376dc42..fa6eb80 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -1,6 +1,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import java.util.ArrayList; @@ -32,7 +33,6 @@ public class TextTest { } /** - * * Test Method del */ @Test @@ -77,8 +77,8 @@ public class TextTest { txt.add("Word word etc. !!test zweite... Zeile"); txt.add("Lorem ipsum lorem ipsum TEST"); stringListe = txt.index(); - Assertions.assertEquals("Word 1, 2",stringListe.get(0)); - Assertions.assertEquals("Test 1, 2, 3",stringListe.get(1)); + Assertions.assertEquals("Word 1, 2", stringListe.get(0)); + Assertions.assertEquals("Test 1, 2, 3", stringListe.get(1)); //End of Test setup(); @@ -86,14 +86,14 @@ public class TextTest { //Positiv Testcase Two txt.add("Word word Word Test"); stringListe = txt.index(); - Assertions.assertEquals("Word 1",stringListe.get(0)); + Assertions.assertEquals("Word 1", stringListe.get(0)); //End of Test setup(); //Negativ Testcase One stringListe = txt.index(); - Assertions.assertEquals(0,stringListe.size()); + Assertions.assertEquals(0, stringListe.size()); } @Test From ba6046ac93ab900df93853840b798e805d0a5a5c Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 10:41:23 +0100 Subject: [PATCH 09/21] reformating code --- src/TextOutput.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/TextOutput.java b/src/TextOutput.java index 16d577a..9b21b07 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -56,7 +56,6 @@ public class TextOutput { currentLength = 0; } System.out.print(word); - if (!(currentWordNumber == lastWordNumber)) { System.out.print(" "); currentLength = currentLength + word.length() + 1; From fb60ea19f07ad7ca73bf677d052a5d8cbe6bdfef Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 12 Nov 2021 10:49:19 +0100 Subject: [PATCH 10/21] Split up index Test method --- docs/{Equivalent.md => EquivalentClass.md} | 2 +- test/TextTest.java | 30 +++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) rename docs/{Equivalent.md => EquivalentClass.md} (97%) diff --git a/docs/Equivalent.md b/docs/EquivalentClass.md similarity index 97% rename from docs/Equivalent.md rename to docs/EquivalentClass.md index 83f7ba7..a697e56 100644 --- a/docs/Equivalent.md +++ b/docs/EquivalentClass.md @@ -1,4 +1,4 @@ -#Equivalent +#Equivalentclass ### Text.java Index method diff --git a/test/TextTest.java b/test/TextTest.java index 376dc42..cae5683 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -6,9 +6,11 @@ import java.util.ArrayList; public class TextTest { Text txt; + ArrayList stringListe; @BeforeEach void setup() { + ArrayList stringListe = new ArrayList<>(); txt = new Text(); } @@ -67,31 +69,35 @@ public class TextTest { /** * Test methode for Index method + * For TestCase Positiv Testcase One, Three and Four Negativ Testcase Two */ @Test - void indexTest() { - ArrayList stringListe; - - //Positiv Testcase One, Three and Four Negativ Testcase Two + void indexTestOne() { txt.add("Word word Test"); txt.add("Word word etc. !!test zweite... Zeile"); txt.add("Lorem ipsum lorem ipsum TEST"); stringListe = txt.index(); Assertions.assertEquals("Word 1, 2",stringListe.get(0)); Assertions.assertEquals("Test 1, 2, 3",stringListe.get(1)); - //End of Test + } - setup(); - - //Positiv Testcase Two + /** + * Test methode for Index method + * For TestCase Positiv Testcase Two + */ + @Test + void indexTestTwo() { txt.add("Word word Word Test"); stringListe = txt.index(); Assertions.assertEquals("Word 1",stringListe.get(0)); - //End of Test + } - setup(); - - //Negativ Testcase One + /** + * Test methode for Index method + * For TestCase Negativ Testcase One + */ + @Test + void indexTestThree() { stringListe = txt.index(); Assertions.assertEquals(0,stringListe.size()); } From bac531a67439c851a77b545828db0ebffc757b7a Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 12 Nov 2021 10:53:40 +0100 Subject: [PATCH 11/21] Split up index Test method --- test/TextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TextTest.java b/test/TextTest.java index fa19e6d..875d14b 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -11,7 +11,7 @@ public class TextTest { @BeforeEach void setup() { - ArrayList stringListe = new ArrayList<>(); + stringListe = new ArrayList<>(); txt = new Text(); } From ed97f2300c1d23cde60965ca6d932aac144d3ccd Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 12 Nov 2021 10:54:37 +0100 Subject: [PATCH 12/21] improved the README.md --- README.md | 84 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 75199a3..910e632 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,66 @@ -# Texteditor - -Texteditor is a program to edit a text by in- and output into the console. - -# Usermanual - -# ADD a paragraph - +#Texteditor +Texteditor is a program to edit a text by using the input and is then able to output it as desired via the console. +#Usermanual +#ADD a paragraph ```ADD``` -First please enter the command add to add a new paragraph at the end of text. Then enter the text you want to add . +Adds custom text to the last paragraph.

+Enter the command add to add a new paragraph at the end of text. After submitting the add command you will be prompted to enter the text to add as last paragraph. ```ADD [n]``` -If you want to add a paragraph between existing paragraphs then please use the command add and then enter the -paragraphnumber it should get. After that enter the text you want to add to that paragraph. - -# DUMMY Text +Adds custom text to the desired paragraph.

+Enter the command add with the paragraph number where it should be added. +After submitting the add [n] command you will be prompted to enter the text to add in the corresponding paragraph. +#DUMMY Text ```DUMMY``` -First please enter the command dummy to enter a pre written paragraph into the text. +Inserts a dummy text at the end of the text.

+Enter the command dummy to enter a pre-written paragraph into the text as your last paragraph. ```DUMMY [n]``` -If you want to enter a pre written dummy paragraph between existing paragraphs then please enter the command dummy and -then enter the paragraphnumber it should get. - -# REPLACE a Text +Inserts a dummy text in the selected paragraph.

+Enter the command dummy with a paragraph number to insert a pre-written dummy text in the corresponding paragraph. +#REPLACE a Text ```REPLACE``` -First please enter the command replace then enter the characters that you want to replace. After that please enter the -new characters that should replace the old characters. If don't enter a paragraphnumber, the change will be made in the -last paragraph. +Replaces desired words in the whole text with a desired replacement.

+Enter the command replace, after submitting the command replace enter the characters that should be replaced. After submitting the characters you will be +need to input the characters wich will replace the previous characters. ```REPLACE [n]``` -If you want to replace a text from a specific paragraph, please enter the command and the paragraphnumber and then enter -the characters you want to replace. After you entered the characters you want to replace please enter now the new -characters that should replace the old characters. - -# DELETE a Text +Replaces desired words in the chosen paragraph [n] text with a desired replacement.

+Enter the command replace with a desired paragraph where the characters should be replaced, +after submitting the command replace enter the characters that should be replaced. After submitting the characters you will be +need to input the characters wich will replace the previous characters. +#DELETE a Text ```DEL``` -First please enter the command del to delete the last paragraph. +Deletes the last paragraph.

+Enter the command del to delete the last paragraph. ```DEL [n]``` -If you want to delete a specific paragraph then please enter the command del and then the paragraph you want to delete. - -# INDEX +Deletes the selected paragraph.

+Enter the command del with a paragraph number, the corresponding paragraph will then be deleted. +#INDEX the words ```INDEX``` -Please enter the command index to show the index. - -# PRINT the Text +Diplays the index of words used 3 times or more.

+Enter the command index to display the words that are displayed more than three times in a paragraph with their corresponding paragraphs. +#Print the Text ```PRINT``` -Please enter the command print to print out the current text you have. To change the output format, use the -commands ```FORMAT FIX``` and ```FORMAT RAW``` - -# FORMAT the Text +Prints the text with the previously set format option.

+Enter the command print to print out the current text you have. The Text will be printed with the settings set before (see FORMAT the Text). +If no settings have been set the standard to output is the RAW format. +#FORMAT the Text ```FORMAT RAW``` -Please enter the command format raw to change the print format to raw. After you changed the format to raw, each -paragraph will be printed on one line with it's paragraph number. +Sets the format to raw.

+Enter the command format raw to change the print format to raw. After you changed the format to raw you can use the command ```PRINT``` again +and each paragraph will be printed on one line with its corresponding paragraph number. ```FORMAT FIX [n]``` -Please enter the command format fix and the line length which should be used. After you changed the format to fix, the -defined line length will be used to print the text. +Sets the format fix with the maximum line length.

+Enter the command format fix and the max line length which will be used. After you changed the format to fix you can use the command ```PRINT``` again +and the text will be displayed with the max length in mind and a new line will be created if no space is left for a paragraph. +If the word is too long to fit the paragraph it will be displayed as whole, ignoring the max length. + From cfafd92f7bb56b7f825b8652c750ee1ab34f9eef Mon Sep 17 00:00:00 2001 From: amadoste Date: Fri, 12 Nov 2021 11:11:03 +0100 Subject: [PATCH 13/21] Added Javadoc to test files. --- ...ruppe06-hufflepuff-projekt2-texteditor.iml | 16 ++++++++++++++ src/TextOutput.java | 21 ++++++++----------- test/TextOutputTest.java | 16 ++++++++++---- test/TextTest.java | 11 ++++++++-- 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/.idea/gruppe06-hufflepuff-projekt2-texteditor.iml b/.idea/gruppe06-hufflepuff-projekt2-texteditor.iml index 0fb1519..324ad0a 100644 --- a/.idea/gruppe06-hufflepuff-projekt2-texteditor.iml +++ b/.idea/gruppe06-hufflepuff-projekt2-texteditor.iml @@ -24,5 +24,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TextOutput.java b/src/TextOutput.java index 625abb8..16d577a 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -17,10 +17,9 @@ public class TextOutput { * @param text the ArrayList which is then formatted into the desired output. */ public void print(ArrayList text) { - if(text.size() == 0) { + if (text.size() == 0) { errorMissingText(); - } - else if (formatRaw) { + } else if (formatRaw) { printFormated(text); } else { toFormat(text); @@ -50,15 +49,15 @@ public class TextOutput { String[] words = paragraph.split(" "); int lastWordNumber = words.length; int currentWordNumber = 0; - for(String word : words) { + for (String word : words) { currentWordNumber++; - if (word.length()>= columnWidth - currentLength && currentWordNumber != 1) { + if (word.length() >= columnWidth - currentLength && currentWordNumber != 1) { System.out.println(); currentLength = 0; } System.out.print(word); - if(!(currentWordNumber == lastWordNumber)) { + if (!(currentWordNumber == lastWordNumber)) { System.out.print(" "); currentLength = currentLength + word.length() + 1; } else { @@ -86,12 +85,11 @@ public class TextOutput { * @param length the paragraph length when printing the text. */ public void formatFix(int length) { - if(length > 0) { + if (length > 0) { formatRaw = false; columnWidth = length; userInfoOutput("Command was successful"); - } - else { + } else { System.err.println("Minimum length has to be greater than 0"); } } @@ -111,10 +109,9 @@ public class TextOutput { * @param index ArrayList with words and in which part they have */ public void indexOutput(ArrayList index) { - if(index.size() == 0) { + if (index.size() == 0) { userInfoOutput("index empty"); - } - else { + } else { for (String word : index) { System.out.println(word); } diff --git a/test/TextOutputTest.java b/test/TextOutputTest.java index 17d72b9..d417818 100644 --- a/test/TextOutputTest.java +++ b/test/TextOutputTest.java @@ -4,26 +4,34 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; +/** + * New class TextOutputTest + * This class is here to test the class TextOutput and to test the console output of that class. + * Author: Leonardo Brandenberger + * Date: 12.11.2021 + */ class TextOutputTest { TextOutput textOutput; ArrayList text; + /** + * This method is here as a preparation for the test. + */ @BeforeEach public void setup() { textOutput = new TextOutput(); textOutput.formatFix(20); - //textOutput.formatRaw(); text = new ArrayList<>(); text.add("Virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, septentr ionesimmensoslongusw ordos."); text.add("Virtutedasjdhashdkjhakjdhakdshjkashd praecedunt, quod fere cotidianis proeliis cum"); - //text.add("ordos."); text.add("1234"); text.add("12417575147517845 445264565"); text.add(" "); - //text.add("1eeeeeee8597389751"); - //text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText"); } + /** + * This method is the test to show if the console output works as we expect it to. + */ @Test public void print() { textOutput.print(text); diff --git a/test/TextTest.java b/test/TextTest.java index 376dc42..b1049de 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -3,10 +3,18 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.ArrayList; - +/** + * New class TextTest + * This class is here to test the different methods of the Text class. + * Author: Roman Schenk, Andrin Fassbind + * Date: 12.11.2021 + */ public class TextTest { Text txt; + /** + * This method is here as a preparation for the test. + */ @BeforeEach void setup() { txt = new Text(); @@ -32,7 +40,6 @@ public class TextTest { } /** - * * Test Method del */ @Test From 03d69783cdbb754347848b5c1ff1bc222ef6e06d Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 11:16:04 +0100 Subject: [PATCH 14/21] removed test method testing from TextTest.java --- test/TextTest.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/TextTest.java b/test/TextTest.java index dfe0aba..2a72b28 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -109,10 +109,4 @@ public class TextTest { stringListe = txt.index(); Assertions.assertEquals(0, stringListe.size()); } - - @Test - void testing() { - txt.add(""); - txt.index(); - } } From 6b7c4fb736da403ad855bedc56a81dd033445704 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 12 Nov 2021 11:19:10 +0100 Subject: [PATCH 15/21] index method error removed --- src/Text.java | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Text.java b/src/Text.java index 2ca4077..afada4b 100644 --- a/src/Text.java +++ b/src/Text.java @@ -181,28 +181,30 @@ public class Text { String firstLetter; String restLetters; for (int i = 0; i < text.size(); i++) { - String[] words = text.get(i).trim().toLowerCase().split("[ :;.,!?><+*}{)('/\n]+"); + String[] words = text.get(i).trim().toLowerCase().split("[. ,:?!\"'-]+"); for (String word : words) { //Words get formatted consistently - counter = 1; - firstLetter = word.substring(0, 1); - restLetters = word.substring(1); - word = firstLetter.toUpperCase() + restLetters; - //Words are beeing counted - if (wordbook.containsKey(word)) { - numbersList = wordbook.get(word); - counter = numbersList.get(0); - numbersList.remove(0); - numbersList.add(0, counter + 1); - if (numbersList.get(numbersList.size() - 1) < i + 1) { + if(word.length()>0){ + counter = 1; + firstLetter = word.substring(0, 1); + restLetters = word.substring(1); + word = firstLetter.toUpperCase() + restLetters; + //Words are beeing counted + if (wordbook.containsKey(word)) { + numbersList = wordbook.get(word); + counter = numbersList.get(0); + numbersList.remove(0); + numbersList.add(0, counter + 1); + if (numbersList.get(numbersList.size() - 1) < i + 1) { + numbersList.add(i + 1); + } + } else { + numbersList = new ArrayList<>(); + numbersList.add(counter); numbersList.add(i + 1); } - } else { - numbersList = new ArrayList<>(); - numbersList.add(counter); - numbersList.add(i + 1); + wordbook.put(word, numbersList); } - wordbook.put(word, numbersList); } } } From e40c7ddcf64012383bea4ab2073433cc6132b6b4 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 12 Nov 2021 11:33:32 +0100 Subject: [PATCH 16/21] reformat code --- src/Text.java | 2 +- test/TextTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Text.java b/src/Text.java index afada4b..fcd6264 100644 --- a/src/Text.java +++ b/src/Text.java @@ -184,7 +184,7 @@ public class Text { String[] words = text.get(i).trim().toLowerCase().split("[. ,:?!\"'-]+"); for (String word : words) { //Words get formatted consistently - if(word.length()>0){ + if (word.length() > 0) { counter = 1; firstLetter = word.substring(0, 1); restLetters = word.substring(1); diff --git a/test/TextTest.java b/test/TextTest.java index 2a72b28..028f7d2 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -95,7 +95,7 @@ public class TextTest { */ @Test void indexTestTwo() { - txt.add("Word word Word Test"); + txt.add("\"Word word Word Test"); stringListe = txt.index(); Assertions.assertEquals("Word 1", stringListe.get(0)); } From e64590d931d216679a50bbed85fa499a692902d1 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 11:47:23 +0100 Subject: [PATCH 17/21] added testmethod indexTestFour in TextTest.java --- test/TextTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/TextTest.java b/test/TextTest.java index 028f7d2..61d1372 100644 --- a/test/TextTest.java +++ b/test/TextTest.java @@ -109,4 +109,13 @@ public class TextTest { stringListe = txt.index(); Assertions.assertEquals(0, stringListe.size()); } + + /** + * Test Method to check if index is working with empty Strings + */ + @Test + void indexTestFour() { + txt.add(""); + txt.index(); + } } From b5d841dbc6bc86872762db7a57d678ab8d349600 Mon Sep 17 00:00:00 2001 From: brandleo Date: Fri, 12 Nov 2021 15:07:57 +0100 Subject: [PATCH 18/21] Delete Kick-off.md --- docs/Kick-off.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 docs/Kick-off.md diff --git a/docs/Kick-off.md b/docs/Kick-off.md deleted file mode 100644 index 8d980f6..0000000 --- a/docs/Kick-off.md +++ /dev/null @@ -1,23 +0,0 @@ -# Projekt TextEditor - -## Auftragsaufteilung - -**Michael** - -- [ ] - -**Leonardo** - -- [ ] - -**Andrin** - -- [ ] - -**Roman** - -- [ ] - -**Stefan** - -- [ ] \ No newline at end of file From 35f92874a87be9f8e26b6b9c53ef4e47a50e894a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 15:15:38 +0100 Subject: [PATCH 19/21] changes in README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 910e632..0475584 100644 --- a/README.md +++ b/README.md @@ -3,26 +3,26 @@ Texteditor is a program to edit a text by using the input and is then able to ou #Usermanual #ADD a paragraph ```ADD``` -Adds custom text to the last paragraph.

+Adds a paragraph with custom text.

Enter the command add to add a new paragraph at the end of text. After submitting the add command you will be prompted to enter the text to add as last paragraph. ```ADD [n]``` -Adds custom text to the desired paragraph.

+Adds a paragraph with custom text at a specific position in text.

Enter the command add with the paragraph number where it should be added. After submitting the add [n] command you will be prompted to enter the text to add in the corresponding paragraph. #DUMMY Text ```DUMMY``` -Inserts a dummy text at the end of the text.

+Inserts a paragraph with dummy text at the end of the text.

Enter the command dummy to enter a pre-written paragraph into the text as your last paragraph. ```DUMMY [n]``` -Inserts a dummy text in the selected paragraph.

-Enter the command dummy with a paragraph number to insert a pre-written dummy text in the corresponding paragraph. +Inserts a paragraph with dummy text at a specific position.

+Enter the command dummy with a paragraph number to insert a pre-written dummy text paragraph to a spcific position. #REPLACE a Text ```REPLACE``` -Replaces desired words in the whole text with a desired replacement.

+Replaces desired words in the last paragraph with a desired replacement.

Enter the command replace, after submitting the command replace enter the characters that should be replaced. After submitting the characters you will be need to input the characters wich will replace the previous characters. @@ -44,13 +44,13 @@ Enter the command del with a paragraph number, the corresponding paragraph will #INDEX the words ```INDEX``` Diplays the index of words used 3 times or more.

-Enter the command index to display the words that are displayed more than three times in a paragraph with their corresponding paragraphs. +Enter the command index to display the words that are displayed more than three times in the text with their corresponding paragraphs. #Print the Text ```PRINT``` Prints the text with the previously set format option.

Enter the command print to print out the current text you have. The Text will be printed with the settings set before (see FORMAT the Text). -If no settings have been set the standard to output is the RAW format. +If no settings have been set the standard to output is the FIX format and a line length of 20. #FORMAT the Text ```FORMAT RAW``` @@ -62,5 +62,5 @@ and each paragraph will be printed on one line with its corresponding paragraph Sets the format fix with the maximum line length.

Enter the command format fix and the max line length which will be used. After you changed the format to fix you can use the command ```PRINT``` again and the text will be displayed with the max length in mind and a new line will be created if no space is left for a paragraph. -If the word is too long to fit the paragraph it will be displayed as whole, ignoring the max length. +If a word is too long to fit the line length, it will be displayed as whole, ignoring the max length. From 5aa6bf5df03028302a1c399ffa83f2ec940680cf Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 18:06:35 +0100 Subject: [PATCH 20/21] added class diagram to README.md --- README.md | 23 +++++++++++++++-------- docs/PM2_ClassDiagram.drawio.svg | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 docs/PM2_ClassDiagram.drawio.svg diff --git a/README.md b/README.md index 0475584..a1a0ccf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ #Texteditor Texteditor is a program to edit a text by using the input and is then able to output it as desired via the console. -#Usermanual -#ADD a paragraph +##Usermanual +###ADD a paragraph ```ADD``` Adds a paragraph with custom text.

Enter the command add to add a new paragraph at the end of text. After submitting the add command you will be prompted to enter the text to add as last paragraph. @@ -11,7 +11,7 @@ Adds a paragraph with custom text at a specific position in text.

Enter the command add with the paragraph number where it should be added. After submitting the add [n] command you will be prompted to enter the text to add in the corresponding paragraph. -#DUMMY Text +###DUMMY Text ```DUMMY``` Inserts a paragraph with dummy text at the end of the text.

Enter the command dummy to enter a pre-written paragraph into the text as your last paragraph. @@ -20,7 +20,7 @@ Enter the command dummy to enter a pre-written paragraph into the text as your l Inserts a paragraph with dummy text at a specific position.

Enter the command dummy with a paragraph number to insert a pre-written dummy text paragraph to a spcific position. -#REPLACE a Text +###REPLACE a Text ```REPLACE``` Replaces desired words in the last paragraph with a desired replacement.

Enter the command replace, after submitting the command replace enter the characters that should be replaced. After submitting the characters you will be @@ -32,7 +32,7 @@ Enter the command replace with a desired paragraph where the characters should b after submitting the command replace enter the characters that should be replaced. After submitting the characters you will be need to input the characters wich will replace the previous characters. -#DELETE a Text +###DELETE a Text ```DEL``` Deletes the last paragraph.

Enter the command del to delete the last paragraph. @@ -41,18 +41,18 @@ Enter the command del to delete the last paragraph. Deletes the selected paragraph.

Enter the command del with a paragraph number, the corresponding paragraph will then be deleted. -#INDEX the words +###INDEX the words ```INDEX``` Diplays the index of words used 3 times or more.

Enter the command index to display the words that are displayed more than three times in the text with their corresponding paragraphs. -#Print the Text +###Print the Text ```PRINT``` Prints the text with the previously set format option.

Enter the command print to print out the current text you have. The Text will be printed with the settings set before (see FORMAT the Text). If no settings have been set the standard to output is the FIX format and a line length of 20. -#FORMAT the Text +###FORMAT the Text ```FORMAT RAW``` Sets the format to raw.

Enter the command format raw to change the print format to raw. After you changed the format to raw you can use the command ```PRINT``` again @@ -64,3 +64,10 @@ Enter the command format fix and the max line length which will be used. After y and the text will be displayed with the max length in mind and a new line will be created if no space is left for a paragraph. If a word is too long to fit the line length, it will be displayed as whole, ignoring the max length. + +##Classdiagramm + +
+ + +![Classdiagramm](docs/PM2_ClassDiagram.drawio.svg) diff --git a/docs/PM2_ClassDiagram.drawio.svg b/docs/PM2_ClassDiagram.drawio.svg new file mode 100644 index 0000000..72c4b65 --- /dev/null +++ b/docs/PM2_ClassDiagram.drawio.svg @@ -0,0 +1 @@ + \ No newline at end of file From 37a9e37e6a07a239cd8dca46ca4f2c711c8359fe Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 18:06:58 +0100 Subject: [PATCH 21/21] added class diagram to README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index a1a0ccf..6437956 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,4 @@ If a word is too long to fit the line length, it will be displayed as whole, ign ##Classdiagramm -
- - ![Classdiagramm](docs/PM2_ClassDiagram.drawio.svg)