From d3e26c61aac2913af52187e51b111759215a1cc4 Mon Sep 17 00:00:00 2001 From: amadoste Date: Fri, 12 Nov 2021 08:56:31 +0100 Subject: [PATCH] Corrections to Javadocs have been made. --- src/Text.java | 36 ++++++++++++++++++------------------ src/TextEditor.java | 4 ++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/Text.java b/src/Text.java index c1391da..21a3df7 100644 --- a/src/Text.java +++ b/src/Text.java @@ -8,10 +8,10 @@ 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?"; /** - * Method to check if a specific Paragraph exists + * Method to check if a specific paragraph exists. * - * @param paragraphNumber the number of the paragraph which should be checked - * @return returns true if the paragraph exists + * @param paragraphNumber the number of the paragraph which should be checked. + * @return returns true if the paragraph exists. */ private boolean paragraphExists(int paragraphNumber) { return ((paragraphNumber > 0) && (paragraphNumber <= this.text.size())); @@ -20,9 +20,9 @@ public class Text { /** * Method to add a paragraph at a specific position. * - * @param paragraphNumber number of paragraph where the new text should be added + * @param paragraphNumber number of paragraph where the new text should be added. * @param text the Text which should be added. - * @return returns true if the given paragraph exists and is added successfully + * @return returns true if the given paragraph exists and is added successfully. */ public boolean add(int paragraphNumber, String text) { if (paragraphExists(paragraphNumber)) { @@ -35,8 +35,8 @@ public class Text { /** * Method to add a paragraph at the end of the existing text. * - * @param text the Text which should be added. - * @return returns true if the paragraph is added successfully + * @param text the text which should be added. + * @return returns true if the paragraph is added successfully. */ public boolean add(String text) { this.text.add(text.replaceAll("[^A-Za-z0-9 .,:?!\"'-]","")); @@ -46,7 +46,7 @@ public class Text { /** * Method to get all paragraph of the existing instance. * - * @return returns a ArrayList with all paragraphs inside. + * @return returns an ArrayList with all paragraphs inside. */ public ArrayList getText() { @@ -56,8 +56,8 @@ public class Text { /** * Method to add a dummy text paragraph at a specific position. * - * @param paragraphNumber number of paragraph where the dummy text should be added - * @return returns true if the given paragraph exists and is added successfully + * @param paragraphNumber number of paragraph where the dummy text should be added. + * @return returns true if the given paragraph exists and is added successfully. */ public boolean dummy(int paragraphNumber) { return add(paragraphNumber, dummyText); @@ -66,19 +66,19 @@ public class Text { /** * Method to add a dummy text paragraph at the end of the existing text. * - * @return returns true if the paragraph is added successfully + * @return returns true if the paragraph is added successfully. */ public boolean dummy() { return add(dummyText); } /** - * Method to replace characters in a specific paragraph + * Method to replace characters in a specific paragraph. * * @param paragraphNumber number of paragraph which should be changed. * @param oldChar the old character. * @param newChar the new character. - * @return returns true if the given paragraph exists and is changed successfully + * @return returns true if the given paragraph exists and is changed successfully. */ public boolean replace(int paragraphNumber, String oldChar, String newChar) { if (paragraphExists(paragraphNumber)) { @@ -96,7 +96,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; } @@ -104,8 +104,8 @@ 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 + * This method deletes a specific paragraph. As a parameter it uses a 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 @@ -134,7 +134,7 @@ public class Text { /** * This method creates a ArrayList. * Every word which is used in the text more than 3 times - * will be added to the ArrayList with the paragraphes where the word is been used. + * will be added to the ArrayList with the paragraphs where the word has been used. * * @return ArrayList */ @@ -164,7 +164,7 @@ 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. + * 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) { diff --git a/src/TextEditor.java b/src/TextEditor.java index e9b9b48..9839adb 100644 --- a/src/TextEditor.java +++ b/src/TextEditor.java @@ -1,5 +1,9 @@ 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();