-
Notifications
You must be signed in to change notification settings - Fork 193
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
[Edly Irsyad] iP #195
Open
edlyIrsyad
wants to merge
30
commits into
nus-cs2113-AY2122S1:master
Choose a base branch
from
edlyIrsyad: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
[Edly Irsyad] iP #195
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
2ca6058
Add Increment: Level-0
edlyIrsyad 10ba1da
Add Level - 1
edlyIrsyad b90d4e3
Add Level-2
edlyIrsyad eca446a
Level-3
edlyIrsyad 168beaa
Add A-CodingStandard
edlyIrsyad f4b4949
Add Level-4
edlyIrsyad 5ac4a58
Add A-CodeQuality
edlyIrsyad 5618bca
Add Level-5
edlyIrsyad 5cbca39
Add A-Packages
edlyIrsyad a2306a9
Add A-Exceptions
edlyIrsyad 72a0b53
Add Test Commit
edlyIrsyad 54bcd53
Add Another Test Commit
edlyIrsyad 5edf6d7
Merge branch 'branch-Level-5'
edlyIrsyad 40728f4
Add Level-6
edlyIrsyad 0957d93
Add A-Collections
edlyIrsyad c695218
Add Level-7
edlyIrsyad 540ecd5
Add minor change
edlyIrsyad 03ddc96
Merge branch 'branch-Level-6'
edlyIrsyad 1bd6a31
Merge branch 'branch-Level-7'
edlyIrsyad 705b2fb
Add A-Jar
edlyIrsyad e9ce696
Add A-MoreOOP
edlyIrsyad 682547b
Add Level-9
edlyIrsyad ffcb230
Add A-JavaDoc
edlyIrsyad d89c914
Add A-UserGuide
edlyIrsyad 40f25b2
Add branch-A-JavaDoc
edlyIrsyad 9f2e73e
Add Ui updates
edlyIrsyad d9556fc
Merge pull request #1 from edlyIrsyad/branch-Level-9
edlyIrsyad 6e8a540
Change Headings
edlyIrsyad 79954e0
Change Task Details
edlyIrsyad 23e3fb1
Set theme jekyll-theme-merlot
edlyIrsyad 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 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,7 @@ | ||
[T] [ ] list | ||
[T] [ ] bathe | ||
[T] [ ] bathe list | ||
[T] [ ] math | ||
[T] [ ] math test | ||
[T] [ ] english test | ||
[D] [ ] testing |
This file contains 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,29 +1,156 @@ | ||
# User Guide | ||
|
||
# Duke User Guide | ||
Welcome to Duke, your very own command line task scheduler! In this user guide, you can find out how to use Duke. | ||
## Features | ||
|
||
### Feature-ABC | ||
### Track your tasks! | ||
- Add your tasks to our database | ||
- Check tasks off when you've completed them | ||
- Never miss another task ever! | ||
|
||
### 3 different types of tasks | ||
- Todo: Simple description, no deadline/ time | ||
- Deadlines: Description with deadline to be completed by | ||
- Events: Description with the date and time of the event | ||
|
||
## List of commands | ||
|
||
### 1. `todo` - Adds a Todo task to the database | ||
|
||
- Briefly describe the Todo task after typing `todo` | ||
|
||
#### Example of usage: | ||
|
||
`todo clean kitchen` | ||
|
||
#### Expected outcome: | ||
``` | ||
Got it. I've added this task: | ||
[T][ ] clean kitchen | ||
Now you have 1 tasks in your list. | ||
``` | ||
#### Description of the outcome. | ||
- The first box shows that the task is of the Todo type, represented by a 'T' | ||
- The next box is empty, showing that the task has not been completed yet | ||
- If there is a cross 'X' in it, the task has been completed | ||
|
||
|
||
|
||
Description of the feature. | ||
### 2. `deadline` - Adds a Deadline task to the database | ||
- Briefly describe the Deadline task after typing `deadline` | ||
- Then type `/by`, followed by the deadline of the Deadline task | ||
|
||
### Feature-XYZ | ||
#### Example of usage: | ||
|
||
Description of the feature. | ||
`deadline finish assignment /by tonight` | ||
|
||
#### Expected outcome: | ||
``` | ||
Got it. I've added this task: | ||
[D][ ] finish assignment by: tonight | ||
Now you have 2 tasks in your list. | ||
``` | ||
#### Description of the outcome. | ||
- The first box shows that the task is of the Deadline type, represented by a 'D' | ||
- The next box is empty, showing that the task has not been completed yet | ||
- If there is a cross 'X' in it, that would mean that the task has been completed | ||
- After the Deadline description, the deadline of the task will be displayed | ||
- In this case, the deadline is tonight | ||
|
||
## Usage | ||
|
||
### `Keyword` - Describe action | ||
### 3. `event` - Adds an Event task to the database | ||
- Briefly describe the Event task after typing `event` | ||
- Then type `/at`, followed by the date and time of the Event task | ||
|
||
Describe the action and its outcome. | ||
#### Example of usage: | ||
|
||
`event CS2113T exam /at 31 Feb 2021` | ||
|
||
#### Expected outcome: | ||
``` | ||
Got it. I've added this task: | ||
[E][ ] CS2113T exam at: 31 Feb 2021 | ||
Now you have 3 tasks in your list. | ||
``` | ||
#### Description of the outcome. | ||
- The first box shows that the task is of the Event type, represented by an 'E' | ||
- The next box is empty, showing that the task has not been completed yet | ||
- If there is a cross 'X' in it, that would mean that the task has been completed | ||
- After the Event description, the date and time of the task will be displayed | ||
- In this case, the date and time is 31 Feb 2021 | ||
|
||
Example of usage: | ||
|
||
`keyword (optional arguments)` | ||
### 4. `list` - Prints a list of all tasks that have been added | ||
|
||
Expected outcome: | ||
#### Example of usage: | ||
|
||
Description of the outcome. | ||
`list` | ||
|
||
#### Expected outcome: | ||
``` | ||
Here are the tasks in your list: | ||
1. [T][ ] clean kitchen | ||
2. [D][ ] finish assignment by: tonight | ||
3. [E][ ] CS2113T exam at: 31 Feb 2021 | ||
``` | ||
expected output | ||
#### Description of the outcome. | ||
- The tasks that have been added are numbered sequentially | ||
|
||
|
||
### 5. `done` - Indicate to Duke that you have completed a task | ||
- After typing `done`, type the index of the task you have completed | ||
|
||
#### Example of usage: | ||
|
||
`done 1` | ||
|
||
#### Expected outcome: | ||
``` | ||
Nice! I've marked this task as done: | ||
[T][X] clean kitchen | ||
``` | ||
#### Description of the outcome. | ||
- The second box will have an 'X' to indicate that it is checked | ||
|
||
|
||
|
||
### 6. `find` - Prints all the tasks that match the keyword you give it | ||
- After typing `find`, type the keyword of the tasks you are searching for | ||
#### Example of usage: | ||
|
||
`find finish` | ||
|
||
#### Expected outcome: | ||
``` | ||
Here are the matching tasks in your list: | ||
1. [D][ ] finish assignment by: tonight | ||
``` | ||
#### Description of the outcome. | ||
- Since the word 'finish' appears in the above task, it will be displayed | ||
|
||
|
||
|
||
### 7. `delete` - Removes a task from the database | ||
- After typing `delete`, type the index of the task you want to delete | ||
#### Example of usage: | ||
|
||
`delete 1` | ||
|
||
#### Expected outcome: | ||
``` | ||
Noted. I've removed this task: | ||
[T][X] clean kitchen | ||
Now you have 2 tasks in the list. | ||
``` | ||
|
||
|
||
|
||
### 8. `bye` - Exits Duke | ||
|
||
#### Example of usage: | ||
|
||
`bye` | ||
|
||
#### Expected outcome: | ||
``` | ||
Byebye! Hope to see you again soon! | ||
``` |
This file contains 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 @@ | ||
theme: jekyll-theme-merlot |
This file contains 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,21 @@ | ||
/** | ||
* Class inheriting from Task that has a description and deadline attribute | ||
*/ | ||
public class Deadline extends Task{ | ||
protected String by; | ||
|
||
public Deadline(String description, String by) { | ||
super(description); | ||
this.by = by.substring(by.indexOf(" ") + 1); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return description + "(by: " + by + ")"; | ||
} | ||
|
||
@Override | ||
public String getSymbol() { | ||
return "D"; // mark Deadlines with a "D" | ||
} | ||
} |
This file contains 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,10 +1,16 @@ | ||
/** | ||
* <h1>Track Your Tasks!</h1> | ||
* * The Duke program keeps track of your tasks by categorising them | ||
* * into ToDos, Deadlines and Events and giving you the tools to | ||
* * organise them | ||
* * <p> | ||
* * | ||
* * @author Edly Irsyad | ||
* * @version 0.2 | ||
*/ | ||
public class Duke { | ||
public static void main(String[] args) { | ||
String logo = " ____ _ \n" | ||
+ "| _ \\ _ _| | _____ \n" | ||
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
Ui.welcome(); | ||
Parser.parse(); | ||
} | ||
} |
This file contains 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,5 @@ | ||
/** | ||
* Class representing the DukeException | ||
*/ | ||
public class DukeException extends Exception{ | ||
} |
This file contains 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,21 @@ | ||
/** | ||
* Class inheriting from Task that has a description and date/time attribute | ||
*/ | ||
public class Event extends Task{ | ||
protected String eventDateTime; | ||
|
||
public Event(String description, String eventDateTime) { | ||
super(description); | ||
this.eventDateTime = eventDateTime.substring(eventDateTime.indexOf(" ") + 1); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return description + "(at: " + eventDateTime + ")"; | ||
} | ||
|
||
@Override | ||
public String getSymbol() { | ||
return "E"; // mark Events with an "E" | ||
} | ||
} |
This file contains 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,77 @@ | ||
import java.io.IOException; | ||
import java.util.Scanner; | ||
|
||
/** | ||
* Continually parses through the user's commands then determines the next course of action by calling the appropriate class | ||
*/ | ||
public class Parser { | ||
public static void parse() { | ||
String toBeWritten = null; | ||
String dukeDataPath = "C:\\Users\\edly1\\Documents\\ip\\data\\dukeData.txt"; | ||
Scanner in = new Scanner(System.in); | ||
boolean isContinueLoop = true; | ||
|
||
while(isContinueLoop){ | ||
String userIn = in.nextLine(); | ||
String userCommand = userIn.contains(" ") ? userIn.substring(0, userIn.indexOf(" ")): userIn; | ||
String userCommandDetails = userIn.contains(" ") ? userIn.substring(userIn.indexOf(" ") + 1): "invalid"; | ||
|
||
switch (userCommand) { | ||
case "todo": | ||
toBeWritten = TaskList.addToDo(userCommandDetails, toBeWritten); | ||
try { | ||
if (toBeWritten != null) { | ||
Storage.writeToFile(dukeDataPath, toBeWritten + System.lineSeparator()); | ||
} | ||
} catch (IOException e) { | ||
System.out.println("Something went wrong: " + e.getMessage()); | ||
} | ||
break; | ||
case "deadline": | ||
toBeWritten = TaskList.addDeadline(userCommandDetails, toBeWritten); | ||
try { | ||
if (toBeWritten != null) { | ||
Storage.writeToFile(dukeDataPath, toBeWritten + System.lineSeparator()); | ||
} | ||
} catch (IOException e) { | ||
System.out.println("Something went wrong: " + e.getMessage()); | ||
} | ||
break; | ||
case "event": | ||
toBeWritten = TaskList.addEvent(userCommandDetails, toBeWritten); | ||
try { | ||
if (toBeWritten != null) { | ||
Storage.writeToFile(dukeDataPath, toBeWritten + System.lineSeparator()); | ||
} | ||
} catch (IOException e) { | ||
System.out.println("Something went wrong: " + e.getMessage()); | ||
} | ||
break; | ||
|
||
case "list": | ||
TaskList.list(); | ||
break; | ||
|
||
case "done": | ||
TaskList.done(userIn); | ||
break; | ||
|
||
case "find": | ||
TaskList.find(userCommandDetails); | ||
break; | ||
|
||
case "delete": | ||
TaskList.delete(userIn); | ||
break; | ||
|
||
case "bye": | ||
Ui.farewell(); | ||
isContinueLoop = false; | ||
break; | ||
default: | ||
Ui.invalidCommand(userIn); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains 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,19 @@ | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
|
||
/** | ||
* Saves tasks in the target file | ||
*/ | ||
public class Storage { | ||
/** | ||
* Writes Task description and details into the file | ||
* | ||
* @param filePath Location of the target file to be written to with respect to the C-drive | ||
* @param textToAdd Message to be written to the target file | ||
*/ | ||
public static void writeToFile(String filePath, String textToAdd) throws IOException { | ||
FileWriter fw = new FileWriter(filePath, true); | ||
fw.write(textToAdd); | ||
fw.close(); | ||
} | ||
} |
This file contains 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,24 @@ | ||
/** | ||
* Abstract class representing the general structure of a Task | ||
*/ | ||
public class Task { | ||
protected String description; | ||
protected boolean isDone; | ||
|
||
public Task(String description) { | ||
this.description = description; | ||
this.isDone = false; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public String getSymbol() { | ||
return " "; // mark Tasks with a " " | ||
} | ||
|
||
public String getStatusIcon() { | ||
return (isDone ? "X" : " "); // mark done task with X | ||
} | ||
} |
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.
Consider removing the comment since the code is self-explanatory.