Skip to content
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

[Wang Silang] iP #214

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|


```

wang silang
170 changes: 156 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,171 @@
# User Guide
# Duke: Your Personal Agenda Assistant 📑

## Features
Duke is a Java personal agenda keeper. He is smart enough to assist in your daily activity planning. Below are his functionalities:

### Feature-ABC
1. [Add Task](#add)
1. [Todo](#t)
2. [Event](#e)
3. [Deadline](#d)
2. [Mark/Unmark Task](#mum)
1. [Mark Task](#mt)
2. [Unmark Task](#u)
3. [Delete Task](#dt)
4. [List Task](#lt)
5. [Find Task](#ft)
6. [Exit](#end)
--------------------------------------------------------------------
# NOTE:
* Follow the input format as mentioned below to avoid errors.
--------------------------------------------------------------------

Description of the feature.
# 1. Add Task <a name = "add"></a>

### Feature-XYZ
You can add 3 types of tasks, Todos, Events and Deadlines.

Description of the feature.
## 1.1. Todo <a name = "t"></a>
* COMMAND: todo {task}

## Usage

### `Keyword` - Describe action
Input:

Describe the action and its outcome.
```todo return book```

Example of usage:
Output:
```
As per requested Sire, this task has been added to your calendar.
[T][ ] return book
You now have 7 items left
```


## 1.2. Event <a name = "e"></a>
* COMMAND: event {task} \from {string} \to {string}

Input:

```event meeting with friend /from 4pm /to 6pm```

Output:
```
As per requested Sire, this task has been added to your calendar.
[E][ ] meeting with friend (from: 4pm to: 6pm)
You now have 8 items left
```

## 1.3. Deadline <a name = "d"></a>
* Command: deadline {task} \by {string}

Input:

```deadline finish CS2113 assignment/by Sunday```

Output:
```
As per requested Sire, this task has been added to your calendar.
[D][ ] finish CS2113 assignmen (by: Sunday)
You now have 9 items left
```


# 2. Mark/Unmark Task <a name = "mum"></a>

Mark the task at the index keyed in by users as done, or unmark it as unfinished.
For index of all current tasks, please see [List Task](#lt).

## 2.1. Mark Task <a name="mt"></a>
* COMMAND: mark {enter task_index}

Input:

```mark 1```

Output:

```
Sir, your task has been marked as completed.
[T][X] Finish CS2113 iP
```

## 2.2. Unmark Task <a name="u"></a>
* COMMAND: unmark {enter task_index}

Input:

```unmark 2```

Output:

```
Sir, your task has been unmarked as requested.
[T][ ] sleep
```

# 3. Delete Task <a name = "dt"></a>

Delete task at keyed in index as follows:

* COMMAND: delete {enter task_index}

Input:

```delete 1```

Output:

```
Sire, I have removed this task from your schedule
[T][X] Finish CS2113 iP
You now have 8 items left
```

# 4. List Task <a name = "lt"></a>

List all tasks in the list as follows:

* COMMAND: list

Input:

```list```

`keyword (optional arguments)`
Output:

Expected outcome:
```
Your current list of items as requested, sir.
1.[T][ ] sleep
2.[E][ ] project meeting (from: Mon 2pm to: 4pm)
3.[T][ ] return book
4.[E][ ] meeting with friend (from: 4pm to: 6pm)
```

# 5. Find Task <a name = "ft"></a>

Find the desired tasks by keying in a term they contain as follows:

Description of the outcome.
* COMMAND: find {keyword}

Input:

```find friend```

Output:
```
expected output
Here are the matching items Sire:
[E][ ] meeting with friend (from: 4pm to: 6pm)
```


# 6. Exit <a name = "end"></a>

Exit the program as follows:

Input:

```bye```

Output:
```
Glad I could be of help!
```

# End of user guide
61 changes: 61 additions & 0 deletions src/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

46 changes: 46 additions & 0 deletions src/main/java/Duke/Duke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package Duke;

public class Duke {
private Ui ui;
private Storage storage;
private TaskList tasklist;
private Parser parser;
private final int PARSERINDEX = 1;

public Duke(String filePath) {
ui = new Ui();
storage = new Storage();
tasklist = new TaskList(filePath);
parser = new Parser();
}

public void run() {
ui.greet();
while (parser.getIsRunning()) {
String commandToBeParsed = ui.readCommand();
String commandParsed = parser.parseCommand(commandToBeParsed);
if (commandParsed.startsWith("B")) { // bye from user, terminate program
parser.setIsRunning(false);
} else if (commandParsed.startsWith("L")) { // print list
tasklist.printCurrentList();
} else if (commandParsed.startsWith("F")) { // find tasks in list
tasklist.printTasksFound(commandParsed.substring(PARSERINDEX));
} else if (commandParsed.startsWith("M")) { // mark task
tasklist.mark(commandParsed.substring(PARSERINDEX));
} else if (commandParsed.startsWith("U")) { // unmark task
tasklist.unmark(commandParsed.substring(PARSERINDEX));
} else if (commandParsed.startsWith("D")) { // delete task
tasklist.delete(commandParsed.substring(PARSERINDEX));
} else if (commandParsed.startsWith("XNC")) { // null command error
ui.printErrorMessage("Sire, I am not trained to understand gibberish.");
} else { // task keyed in by users
tasklist.addTask(commandParsed.substring(PARSERINDEX));
}
}
ui.bye();
}

public static void main(String[] args) {
new Duke("dukeData.txt").run();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job refactoring the code!

4 changes: 4 additions & 0 deletions src/main/java/Duke/Exception/EmptyDeadlineException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package Duke.Exception;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names representing packages should be in all lower case. Look at Java coding standards for more details.


public class EmptyDeadlineException extends Exception {
}
4 changes: 4 additions & 0 deletions src/main/java/Duke/Exception/EmptyEventsException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package Duke.Exception;

public class EmptyEventsException extends Exception {
}
4 changes: 4 additions & 0 deletions src/main/java/Duke/Exception/EmptyToDoException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package Duke.Exception;

public class EmptyToDoException extends Exception {
}
4 changes: 4 additions & 0 deletions src/main/java/Duke/Exception/NullCommandException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package Duke.Exception;

public class NullCommandException extends Exception {
}
Loading