From 4c7e716143960b5e56bd58e7afcbe63cb57c5bfa Mon Sep 17 00:00:00 2001 From: rexkoh425 Date: Wed, 9 Oct 2024 08:29:23 +0800 Subject: [PATCH] update code quality included
in user guide for number bullets too --- docs/README.md | 52 +++++++++---------- src/main/java/TheThinker/File/FileLoader.java | 3 ++ .../java/TheThinker/Parser/DateParser.java | 6 +-- text-ui-test/basic_inputs.txt | 12 +++++ 4 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 text-ui-test/basic_inputs.txt diff --git a/docs/README.md b/docs/README.md index a8b1d1639..92bfc4b5e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,10 +15,10 @@ Finally, a Save feature is also introduced which allows you to save and load tas # Getting Started -1) Make sure you have Java 17 or above installed on your computer. -2) Download the .jar file -3) Open a terminal in the directory which you saved the .jar file, then run the following: -
`java -jar ip.jar` +1) Make sure you have Java 17 or above installed on your computer.
+2) Download the .jar file
+3) Open a terminal in the directory which you saved the .jar file, then run the following:
+
`java -jar ip.jar`
# Initial configuration @@ -72,10 +72,10 @@ Add task which has a specific deadline. Example: `deadline return book /by 20/10/2025 1800` Formatting rules : -1) "deadline" is not Caps-Sensitive. +1) "deadline" is not Caps-Sensitive.
2) Dates in the form of `dd/MM/yyyy HHmm` (e.g. 20/10/2025 1800) will be converted -to `dd/MMM/yyyy H a` (e.g. 20 October 2025 , 6 pm) automatically -3) Dates other than `dd/MMM/yyyy H a` and `dd/MM/yyyy` format will not be available for the `get` command +to `dd/MMM/yyyy H a` (e.g. 20 October 2025 , 6 pm) automatically
+3) Dates other than `dd/MMM/yyyy H a` and `dd/MM/yyyy` format will not be available for the `get` command
General format : `deadline [task] /by [time]` @@ -96,10 +96,10 @@ Add task which has a duration. Example: `event travel /from 20/10/2025 1800 /to 20/11/2025 1800` Formatting rules : -1) "event" is not Caps-Sensitive. +1) "event" is not Caps-Sensitive.
2) Dates in the form of `dd/MM/yyyy HHmm` (e.g. 20/10/2025 1800) will be converted - to `dd/MMM/yyyy H a` (e.g. 20 October 2025 , 6 pm) automatically -3) Dates other than `dd/MMM/yyyy H a` and `dd/MM/yyyy` format will not be available for the `get` command + to `dd/MMM/yyyy H a` (e.g. 20 October 2025 , 6 pm) automatically
+3) Dates other than `dd/MMM/yyyy H a` and `dd/MM/yyyy` format will not be available for the `get` command
General format : `event [task] /from [start time] /by [end time]` @@ -120,7 +120,7 @@ Add task without deadlines. Example: `todo travel` Formatting rules : -1) "todo" is not Caps-Sensitive. +1) "todo" is not Caps-Sensitive.
General format : `todo [task]` @@ -138,8 +138,8 @@ ____________________________________________________________ Mark task as complete and incomplete. Formatting rules : -1) "mark" / "unmark" is not Caps-Sensitive. -2) Only one task can be marked per command (i.e. `mark 1 2`) is not valid +1) "mark" / "unmark" is not Caps-Sensitive.
+2) Only one task can be marked per command (i.e. `mark 1 2`) is not valid
General format : `mark [number]` @@ -173,9 +173,9 @@ Prints the format for all the commands available Example: `help` Formatting rules : -1) "help" is not Caps-Sensitive. +1) "help" is not Caps-Sensitive.
2) Help command will be triggered if first word is "help" and ignores remainder of the commands - (i.e. `help me with command` , `help 12414`) would work. + (i.e. `help me with command` , `help 12414`) would work.
General format : `help` @@ -201,8 +201,8 @@ Delete a specific task from the list Example: `delete 1` Formatting rules : -1) "delete" is not Caps-Sensitive. -2) Deleting a task using a number greater than total of no. of task will not result in any change. +1) "delete" is not Caps-Sensitive.
+2) Deleting a task using a number greater than total of no. of task will not result in any change.
General format : `delete [number]` @@ -229,11 +229,11 @@ Get all the task which are of specific date Example: `get 20/10/2025` Formatting rules : -1) "get" is not Caps-Sensitive. -2) Date specified must be of `dd/MM/yyyy` format only +1) "get" is not Caps-Sensitive.
+2) Date specified must be of `dd/MM/yyyy` format only
3) Dates in `dd/MMM/yyyy H a` and `dd/MM/yyyy` format will be compared with and task with same day , month and year -will be shown. -4) Multiple dates are not accepted and would result 0 matching cases. +will be shown.
+4) Multiple dates are not accepted and would result 0 matching cases.
General format : `get [dd/MM/yyyy]` @@ -259,9 +259,9 @@ Get all the task which are of specific keyword Example: `find travel` Formatting rules : -1) "find" is not Caps-Sensitive. -2) Keyword should only be 1 word. -4) Multi-word queries are not accepted and would result 0 matching cases. +1) "find" is not Caps-Sensitive.
+2) Keyword should only be 1 word.
+4) Multi-word queries are not accepted and would result 0 matching cases.
General format : `find [single word]` @@ -288,9 +288,9 @@ Exits the program Example: `bye` Formatting rules : -1) "bye" is not Caps-Sensitive. +1) "bye" is not Caps-Sensitive.
2) Bye command will be triggered if first word is "Bye" and ignores remainder of the commands - (i.e. `bye me with command` , `bye 12414`) would work. + (i.e. `bye me with command` , `bye 12414`) would work.
General format : `bye` diff --git a/src/main/java/TheThinker/File/FileLoader.java b/src/main/java/TheThinker/File/FileLoader.java index 21d16d614..80a80f5a9 100644 --- a/src/main/java/TheThinker/File/FileLoader.java +++ b/src/main/java/TheThinker/File/FileLoader.java @@ -92,6 +92,9 @@ private static void createFolder(File directoryName){ } } + /** + * Get user input on whether they want to save task to a file + */ public static boolean shouldSaveTask() { UiControl.printSeparation(); System.out.println("Do you want to save your tasks to a file? yes / no"); diff --git a/src/main/java/TheThinker/Parser/DateParser.java b/src/main/java/TheThinker/Parser/DateParser.java index c075a9c9d..98d165049 100644 --- a/src/main/java/TheThinker/Parser/DateParser.java +++ b/src/main/java/TheThinker/Parser/DateParser.java @@ -115,7 +115,7 @@ private static boolean isMatchingDate(String taskDate , String specifiedDate) { return false; } - public static boolean isDateOnlyFormat(String dateStr){ + private static boolean isDateOnlyFormat(String dateStr){ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); try { @@ -129,7 +129,7 @@ public static boolean isDateOnlyFormat(String dateStr){ } } - public static boolean isDateTimeFormat(String dateStr){ + private static boolean isDateTimeFormat(String dateStr){ try { @@ -142,7 +142,7 @@ public static boolean isDateTimeFormat(String dateStr){ } } - public static boolean isResultDateTimeFormat(String dateStr){ + private static boolean isResultDateTimeFormat(String dateStr){ try { diff --git a/text-ui-test/basic_inputs.txt b/text-ui-test/basic_inputs.txt new file mode 100644 index 000000000..1a40fffba --- /dev/null +++ b/text-ui-test/basic_inputs.txt @@ -0,0 +1,12 @@ +no +todo remove book +deadline get book /by 10/12/2002 1800 +get 10/12/2002 +mark 1 +unmark 1 +delete 1 +event book /from 10/12/2002 1800 /to 12/12/2002 1800 +find book +get 10/12/2002 +list +bye \ No newline at end of file