Skip to content

Commit

Permalink
Tidy JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluiexo authored and Pluiexo committed Feb 25, 2024
1 parent 6ec69dd commit f47fe32
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# plato.Plato project template
# Plato project template

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
This is a project template for a greenfield Java project. It's inspired after the Java mascot _Duke_. Given below are instructions on how to use it.

## Setting up in Intellij

Expand All @@ -13,12 +13,13 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
3. After that, locate the `src/main/java/plato.Plato.java` file, right-click it, and choose `Run plato.Plato.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
3. After that, locate the `src/main/java/plato/Launcher.java` file, right-click it, and choose `Run plato.Launcher.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see a GUI window.
```
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
```
.______ __ ___ .___________. ______
| _ \ | | / \ | | / __ \
| |_) | | | / ^ \ `---| |----`| | | |
| ___/ | | / /_\ \ | | | | | |
| | | `----./ _____ \ | | | `--' |
| _| |_______/__/ \__\ |__| \______/
```
18 changes: 9 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ Usage:

Examples:

* `event cs2103 planning /from 1800 24/02/24 /to 1900 27/02/24`
* `event cs2103 planning /from 1800 23/02/24 /to 1900 27/02/24`

* `event midterm study session /from 01:00pm 28-02-24 /to 02:00pm 30-02-24`
* `event midterm study session /from 01:00pm 28-02-24 /to 02:00pm 01-03-24`

Expected outcome:
```
Got it. I've added this task:
[E][ ] cs2103 planning (from:23-02-2024 18:00)
[E][ ] cs2103 planning (from:23-02-2024 18:00 to: 27-02-24 19:00)
Now you got 3 tasks in your list.
```
### Specification for `[DateTimeFormat]`
Expand Down Expand Up @@ -150,7 +150,7 @@ delete [INDEX]
Examples:
```
mark 1
delete 3
delete 2
```

Expected outcome:
Expand All @@ -159,8 +159,8 @@ Nice! I've marked this task as done:
[T][X] Cook dinner
Noted. I've removed this task
[E][ ] cs2103 planning (from:23-02-2024 18:00)
Now you have 2 taks in the list
[D][ ] cs3230 (by:23-02-2024 23:59)
Now you have 2 tasks in the list
```
---

Expand All @@ -176,7 +176,7 @@ Usage: `find [KEYWORD]`

### View

View the all the task being scheduled on that date.
View the all the task being scheduled on that date. For event task view command only checks the to dateline of the task.

Usage: `view [DateFormats]`

Expand All @@ -187,7 +187,7 @@ Usage: `view [DateFormats]`
Examples:
```
find Cook
view 23-02-24
view 27-02-24
```

Expected outcome:
Expand All @@ -196,7 +196,7 @@ Here are the matching task in your list:
1. [T][X] Cook dinner
Here are the task scheduled on that date:
1. [E][ ] cs2103 planning (from:23-02-2024 18:00)
1. [E][ ] cs2103 planning (from:23-02-2024 18:00 to: 27-02-24 19:00)
```

---
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/plato/parser/DateHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class DateHandler {
//Inspired from: https://www.baeldung.com/java-date-regular-expressions
private static final Pattern PATTERN_DATE =
Pattern.compile("([a-zA-Z]+)?\\s?(?<d>\\d{1,2})[-/](?<m>\\d{1,2})[-/](?<y>\\d{2,4})\\s?([a-zA-Z]+)?");
Pattern.compile("([a-zA-Z]+)?\\s?(?<date>(?<d>\\d{1,2})[-/](?<m>\\d{1,2})[-/](?<y>\\d{2,4}))\\s?([a-zA-Z]+)?");
private static final Pattern TIME_PATTERN =
Pattern.compile("(.+)?\\s?(?<time>(\\d{2}:?\\d{2}))(?<indicator>(?i)\\s?[ap]m)?\\s?(.+)?");
private static final DateTimeFormatter FORMAT_DATE = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
Expand Down Expand Up @@ -64,7 +64,7 @@ public static Optional<LocalTime> checkTime(String testTime) throws PlatoExcepti
//Remove the date so that it is easier to check for the time, and prevent conflicts
Matcher removeDate = PATTERN_DATE.matcher(testTime);
if (removeDate.find()) {
testTime = testTime.replaceAll(removeDate.group(), "");
testTime = testTime.replaceAll(removeDate.group("date"), "");
}

Matcher match = TIME_PATTERN.matcher(testTime);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/plato/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public static String[] parse(String command, TaskManager manager) throws PlatoEx


/**
* @return Whether plato should close the chat-bot.
* Checks if should close the bot.
* @return Whether plato should close the chat bot.
*/
public static boolean isExit() {
return isDead;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/plato/task/Actions.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package plato.task;

/**
* Actions indicate teh type of task
* Actions indicate the type of task.
*/
public enum Actions {
TODO, DEADLINE, EVENT
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/plato/task/TaskManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ public String[] queryTasks(Query act, String instruction) throws PlatoException
* @return A list of items containing the search results.
*/
public String[] findTask(String search) {
List<String> foundTask =
items.stream().map(Task::toString).filter(string -> string.contains(search)).collect(Collectors.toList());
List<String> foundTask = items.stream().map(Task::toString).filter(string -> string.toLowerCase()
.contains(search))
.collect(Collectors.toList());

if (!foundTask.isEmpty()) {
List<String> print = iterateWithIndex(foundTask);
Expand All @@ -301,7 +302,7 @@ public String[] findTask(String search) {
*/
public String[] viewByDate(String date) throws PlatoException {
LocalDate inputDate = DateHandler.checkDate(date).orElseThrow(() -> new PlatoException("dateError"));
System.out.println(inputDate);

List<String> foundDates =
items.stream().filter(item -> isMatchDate(item.getType(), item, inputDate)).map(Task::toString)
.collect(Collectors.toList());
Expand Down
1 change: 0 additions & 1 deletion src/main/java/plato/task/Todo.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package plato.task;


/**
* Create a todo class that only has a name.
*/
Expand Down

0 comments on commit f47fe32

Please sign in to comment.