-
Notifications
You must be signed in to change notification settings - Fork 196
[paklongchiu] iP #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paklongchiu
wants to merge
31
commits into
nus-cs2113-AY2425S2:master
Choose a base branch
from
paklongchiu:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[paklongchiu] iP #192
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
a8435c7
Level-0
1f4bfd9
Revert "Level-0"
0144f1c
Reapply "Level-0"
e3bd341
Enable ability to echo user's input, exit when it is bye
7ce0ae2
Enable the ability to store user's inputs and display them when reque…
0643a10
Add functions to mark and unmark tasks, while adopting a Task class t…
9ac4899
Optimise the way of getting input and check if the code aligns with c…
dd8334e
Using inheritance to support tracking 3 types of tasks: Todo, Deadlin…
cb07f89
Added some exceptions for dealing with errors,
6771044
Using ArrayList<Task> instead of an array to store tasks and turned T…
1eea51f
Enabled deleting tasks from the list by task index
02b0f40
Replaced taskCounter with taskList.size() and utilised taskList.getLa…
4f3ad6c
Created a new class Storage to deal with loading and saving tasks in …
9be6807
Made amendments in parseTaskFromString() so that there is no reassign…
9902379
Merge branch 'branch-Level-6'
217a2dd
Merge branch 'branch-Level-7'
5d4692d
Added loadTasks() and saveTasks() into main() to complete the task sa…
bd41e9f
Fixed the issue of displaying wrong no. of tasks in deleteTask()
a8c554c
Implemented a new class TaskList to contain the task list in Elyk and…
934cd37
Implemented class Ui but yet to incorporate its methods in other classes
27f12a9
Completed implementing all new classes for OOP and modified the logic…
ef12c47
Added "find" command case and method to extract keyword in Parser class
bc5e903
Updated Ui and TaskList classes to find and display matching tasks ac…
21a639f
Updated main logic in Elyk to support finding tasks by a keyword
3dc8f6a
Added JavaDoc comments to the Ui class and all of its methods
f5a0f9d
Added JavaDoc comments to 3 more classes and all of their non-private…
03f4d46
Completed the remaining JavaDoc comments for all classes and methods
071a94a
Merge pull request #1 from paklongchiu/branch-Level-9
paklongchiu 620b83e
Merge branch 'master' into branch-A-JavaDoc
1c329ea
Merge pull request #2 from paklongchiu/branch-A-JavaDoc
paklongchiu 9cc84c0
Explained the 9 main features of Elyk in UG
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,160 @@ | ||
| # Duke User Guide | ||
| # Elyk User Guide | ||
|
|
||
| // Update the title above to match the actual product name | ||
| Elyk is a Personal Assistant Chatbot that acts as a task manager to | ||
| helps users keep track of their tasks via a command line interface (CLI). | ||
|
|
||
| // Product screenshot goes here | ||
| ## Adding ToDos | ||
|
|
||
| // Product intro goes here | ||
| This feature allows users to add and track tasks that are without any date/time | ||
| attached to it, e.g., visit a museum, which are represented by the symbol "T". | ||
|
|
||
| ## Adding deadlines | ||
| Input format: `todo <task description>` | ||
|
|
||
| // Describe the action and its outcome. | ||
| Example: `todo visit a museum` | ||
|
|
||
| // Give examples of usage | ||
| Expected output: | ||
|
|
||
| Example: `keyword (optional arguments)` | ||
| ``` | ||
| Got it. I've added this task: | ||
| [T][ ] visit a museum | ||
| Now you have 5 tasks in the list. | ||
| ``` | ||
|
|
||
| ## Adding Deadlines | ||
|
|
||
| This feature allows users to add and track tasks that need to be done before a | ||
| specific date/time, e.g., finish proposal by 04/06/2025 9pm, which are represented | ||
| by the symbol "D". | ||
|
|
||
| // A description of the expected outcome goes here | ||
| Input format: `deadline <task description> /by <deadline>` | ||
|
|
||
| Example: `deadline finish proposal /by 04/06/2025 9pm` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| expected output | ||
| Got it. I've added this task: | ||
| [D][ ] finish proposal (by: 04/06/2025 9pm) | ||
| Now you have 3 tasks in the list. | ||
| ``` | ||
|
|
||
| ## Feature ABC | ||
| ## Adding Events | ||
|
|
||
| This feature allows users to add and track tasks that start at a specific date/time | ||
| and ends at a specific date/time, e.g., basketball training 3-6pm, which are represented | ||
| by the symbol "E". | ||
|
|
||
| Input format: `event <task description> /from <start time> /to <end time>` | ||
|
|
||
| Example: `event basketball training /from 3pm /to 6pm` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Got it. I've added this task: | ||
| [E][ ] basketball training (from: 3pm to: 6pm) | ||
| Now you have 7 tasks in the list. | ||
| ``` | ||
|
|
||
| ## Listing tasks | ||
|
|
||
| This feature allows users to view all the tasks that have been stored by Elyk. | ||
|
|
||
| Input format: `list` | ||
|
|
||
| Example: `list` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Here are the tasks in your list: | ||
| 1.[T][X] visit a museum | ||
| 2.[D][ ] finish proposal (by: 04/06/2025 9pm) | ||
| 3.[E][ ] basketball training (from: 3pm to: 6pm) | ||
| 4.[T][X] eat dinner | ||
| 5.[T][ ] fitness exercises | ||
| ``` | ||
|
|
||
| ## Marking tasks as Done | ||
|
|
||
| This feature allows users to mark tasks as done, which are represented | ||
| by the symbol "X". | ||
|
|
||
| Input format: `mark <task index>` | ||
|
|
||
| Example: `mark 3` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Nice! I've marked this task as done: | ||
| [E][X] basketball training (from: 3pm to: 6pm) | ||
| ``` | ||
|
|
||
| // Feature details | ||
| ## Marking tasks as Not Done | ||
|
|
||
| This feature allows users to mark tasks as done, which are represented | ||
| by the symbol " ". | ||
|
|
||
| ## Feature XYZ | ||
| Input format: `unmark <task index>` | ||
|
|
||
| Example: `unmark 1` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| OK, I've marked this task as not done yet: | ||
| [T][ ] visit a museum | ||
| ``` | ||
|
|
||
| ## Deleting tasks | ||
|
|
||
| This feature allows users to delete tasks that have been stored by Elyk. | ||
|
|
||
| Input format: `delete <task index>` | ||
|
|
||
| Example: `delete 2` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Noted. I've removed this task: | ||
| [D][ ] finish proposal (by: 04/06/2025 9pm) | ||
| Now you have 4 tasks in the list. | ||
| ``` | ||
|
|
||
| ## Finding tasks | ||
|
|
||
| This feature allows users to search for tasks that contain a certain keyword | ||
| in the description. | ||
|
|
||
| Input format: `find <keyword>` | ||
|
|
||
| Example: `find run` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Here are the matching tasks in your list: | ||
| 1.[T][X] run 10k | ||
| 2.[T][ ] run 5k | ||
| 3.[T][ ] charity run | ||
| 4.[D][ ] slow run (by: 5pm) | ||
| 5.[E][X] running exercise (from: 6pm to: 10pm) | ||
| ``` | ||
|
|
||
| ## Exiting the program | ||
|
|
||
| This feature allows users to say bye to Elyk and exit the chatbot program. | ||
|
|
||
| Input format: `bye` | ||
|
|
||
| Example: `bye` | ||
|
|
||
| Expected output: | ||
|
|
||
| ``` | ||
| Bye. Hope to see you again soon! | ||
|
|
||
| // Feature details | ||
| Process finished with exit code 0 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** | ||
| * A child class of Task class that contains the description and deadline of the tasks | ||
| */ | ||
| public class Deadline extends Task { | ||
|
|
||
| protected String by; | ||
|
|
||
| /** | ||
| * Constructor of Deadline class | ||
| * | ||
| * @param description descriptionof the task | ||
| * @param by deadline of the task | ||
| */ | ||
| public Deadline(String description, String by) { | ||
| super(description); | ||
| this.by = by; | ||
| } | ||
|
|
||
| /** | ||
| * Converts the task to printable String argument | ||
| * | ||
| * @return a String representing the task | ||
| */ | ||
| @Override | ||
| public String toString() { | ||
| return "[D]" + super.toString() + " (by: " + by + ")"; | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /** | ||
| * The main class of task manager: Elyk, which controls all the executions of the main program by | ||
| * utilising the functionality of all the other classes. | ||
| */ | ||
| public class Elyk { | ||
| public static int taskNum = 0; | ||
| public static String input = ""; | ||
| public static String description = ""; | ||
| public static String from = ""; | ||
| public static String to = ""; | ||
| public static String by = ""; | ||
| public static String keyword = ""; | ||
| private static Storage storage; | ||
| private static TaskList taskList; | ||
| private static Ui ui; | ||
|
|
||
| /** | ||
| * Constructor of Elyk class which initialises a Storage, TaskList and Ui | ||
| * | ||
| * @param elykFile path of the file used to load and save tasks | ||
| */ | ||
| public Elyk(String elykFile) { | ||
| ui = new Ui(); | ||
| storage = new Storage(elykFile); | ||
| taskList = storage.loadTasks(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| new Elyk("data/Elyk.txt").run(); | ||
| } | ||
|
|
||
| /** | ||
| * Runs all the features that the task manager Elyk contains | ||
| */ | ||
| public void run() { | ||
| ui.greet(); | ||
|
|
||
| while (true) { | ||
| try { | ||
| input = ui.getNextCommand(); | ||
| String commandType = Parser.updateCommand(input); | ||
| switch (commandType) { | ||
| case "bye": | ||
| ui.sayBye(); | ||
| System.exit(0); | ||
| case "list": | ||
| ui.printTasks(); | ||
| for (int i = 0; i < taskList.size(); i++) { | ||
| ui.printIndividualTask(taskList.getTask(i), i); | ||
| } | ||
| break; | ||
| case "mark": | ||
| taskNum = Parser.getTaskNum(input); | ||
| Task doneTask = taskList.getTask(taskNum - 1); | ||
| doneTask.markAsDone(); | ||
| ui.markTaskDone(doneTask); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "unmark": | ||
| taskNum = Parser.getTaskNum(input); | ||
| Task notDoneTask = taskList.getTask(taskNum - 1); | ||
| notDoneTask.markAsNotDone(); | ||
| ui.markTaskNotDone(notDoneTask); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "delete": | ||
| taskNum = Parser.getTaskNum(input); | ||
| Task deletedTask = taskList.removeTask(taskNum - 1); | ||
| ui.deleteTask(deletedTask, taskList.size()); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "todo": | ||
| description = Parser.getDescription(input, "todo"); | ||
| Task addedTodo = taskList.addTask(new Todo(description)); | ||
| ui.inputTask(addedTodo, taskList.size()); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "deadline": | ||
| description = Parser.getDescription(input, "deadline"); | ||
| by = Parser.getBy(input); | ||
| Task addedDeadline = taskList.addTask(new Deadline(description, by)); | ||
| ui.inputTask(addedDeadline, taskList.size()); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "event": | ||
| description = Parser.getDescription(input, "event"); | ||
| from = Parser.getFrom(input); | ||
| to = Parser.getTo(input); | ||
| Task addedEvent = taskList.addTask(new Event(description, from, to)); | ||
| ui.inputTask(addedEvent, taskList.size()); | ||
| storage.saveTasks(taskList); | ||
| break; | ||
| case "find": | ||
| keyword = Parser.getKeyword(input); | ||
| TaskList foundTasks = taskList.findMatchingTasks(keyword); | ||
| ui.printMatchingTasks(); | ||
| for (int i = 0; i < foundTasks.size(); i++) { | ||
| ui.printIndividualTask(foundTasks.getTask(i), i); | ||
| } | ||
| break; | ||
| default: | ||
| throw new ElykException(); | ||
| } | ||
| } catch (ElykException e) { | ||
| ui.printErrorMessage(" Sorry :( I currently does not support this command, please try again."); | ||
| } catch (IndexOutOfBoundsException e) { | ||
| ui.printErrorMessage(" Hmm... There might be some missing information in your command..."); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| public class ElykException extends Exception { | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * A child class of Task class that contains the description, start and end time of the tasks | ||
| */ | ||
| public class Event extends Task { | ||
|
|
||
| protected String from; | ||
| protected String to; | ||
|
|
||
| /** | ||
| * Constructor of Event class | ||
| * | ||
| * @param description description of the task | ||
| * @param from start time of the task | ||
| * @param to end time of the task | ||
| */ | ||
| public Event(String description, String from, String to) { | ||
| super(description); | ||
| this.from = from; | ||
| this.to = to; | ||
| } | ||
|
|
||
| /** | ||
| * Converts the task to printable String argument | ||
| * | ||
| * @return a String representing the task | ||
| */ | ||
| @Override | ||
| public String toString() { | ||
| return "[E]" + super.toString() + " (from: " + from + " to: " + to + ")"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Manifest-Version: 1.0 | ||
| Main-Class: Elyk | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of while(true), maybe you can consider using this instead:
do {
// code to run
}
while (!input.equal("bye"));