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

[Tan Zheng Fu Justin] iP #62

Open
wants to merge 95 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
f42ae0a
Added greeting and exit methods
JustinnT Jan 21, 2020
bfc9993
Add echoUntilBye class for Level-1
JustinnT Jan 28, 2020
fa62ed7
Add list to store userInput
JustinnT Jan 28, 2020
de3a29a
Add introduction comments
JustinnT Jan 31, 2020
80562eb
Refractor print methods into new Printer class
JustinnT Jan 31, 2020
8ef614e
combine printer methods
JustinnT Jan 31, 2020
4989098
Added method to print tasks
JustinnT Jan 31, 2020
70e53d2
add feature to store and print userinputs into/from a string
JustinnT Jan 31, 2020
eb8183a
Fix infinite loop bug in method echoUntilBye
JustinnT Jan 31, 2020
7ce3414
implement new class to store userinput as tasks
JustinnT Jan 31, 2020
32fa901
Change parameter types due change of userinput type
JustinnT Jan 31, 2020
c0ddd93
change parameter type due to userinput type
JustinnT Jan 31, 2020
e113278
implemente printing symbols
JustinnT Jan 31, 2020
039b06e
changed userInput to store in new class type Task
JustinnT Jan 31, 2020
86ce064
Add new printing message on printing empty list
JustinnT Jan 31, 2020
279c23b
add print error method
JustinnT Jan 31, 2020
a56eecb
add method to mark task as done
JustinnT Jan 31, 2020
f33a405
add method to check if task is valid for exception handling
JustinnT Jan 31, 2020
567d027
renamed method to better reflect its function
JustinnT Jan 31, 2020
a936dae
add try catch statement to catch outofbounds exception
JustinnT Jan 31, 2020
1f00542
implemented method to mark as done
JustinnT Jan 31, 2020
3042ebf
Refractor code to follow java coding standards
JustinnT Jan 31, 2020
0165792
Deleted extra line
JustinnT Jan 31, 2020
0430f62
Refractor if-else statement
JustinnT Jan 31, 2020
e7d092d
add try-catch statement for exception handling
JustinnT Jan 31, 2020
2cf8d6c
added todo class inheriting from Task
JustinnT Feb 4, 2020
1ae1024
overloaded toString in Task and used that to print out Tasks instead.
JustinnT Feb 4, 2020
ca35d97
added new feature to add todo task
JustinnT Feb 4, 2020
37cb07d
overloaded printConfirmationMessage method in Printer class to print …
JustinnT Feb 4, 2020
c75238d
(incomplete) added events class to enable creation of new sub-type of…
JustinnT Feb 8, 2020
5c80014
added support for tracking of todo task
JustinnT Feb 8, 2020
4c80cb8
remove extra try catch statement
JustinnT Feb 8, 2020
4a5fc94
introduced constants for magic numbers
JustinnT Feb 8, 2020
76b2560
added deadline task
JustinnT Feb 8, 2020
2533ea0
changes constant names
JustinnT Feb 8, 2020
2bacb7a
added message for deadline and personalized printer
JustinnT Feb 8, 2020
ed507b4
added parser class to parse user input
JustinnT Feb 8, 2020
280e1a5
changed to static list to access outside of class
JustinnT Feb 8, 2020
b336949
added deadline class
JustinnT Feb 8, 2020
a5cdbc3
added functionality to at event type tasks
JustinnT Feb 8, 2020
109c613
personalized printing messages
JustinnT Feb 8, 2020
a8b00ed
added a new constant
JustinnT Feb 8, 2020
eb3d17c
refractor code
JustinnT Feb 8, 2020
e9104a1
git ignore
JustinnT Feb 8, 2020
4e1bd77
add functionalities to handle more errors
JustinnT Feb 8, 2020
2d96ff4
added comments
JustinnT Feb 8, 2020
5edc8b6
remove comment
JustinnT Feb 8, 2020
725c05c
testing for branch
JustinnT Feb 8, 2020
930d0c6
Merge branch 'master' into branch-Level-5_part2
JustinnT Feb 8, 2020
63f424b
test brach 2
JustinnT Feb 8, 2020
9761edc
Merge branch 'branch-Level-5_part2'
JustinnT Feb 8, 2020
e50b44d
add custom print message for exception handling
JustinnT Feb 9, 2020
254352e
update git ignore
JustinnT Feb 22, 2020
6451c9d
refractor code
JustinnT Feb 22, 2020
8c411ab
added delete functionality
JustinnT Feb 22, 2020
0069b3b
refractor printer class
JustinnT Feb 22, 2020
a28c87b
refractor printer class
JustinnT Feb 22, 2020
a629b3f
Added level 7 save
JustinnT Feb 22, 2020
540585f
Merge branch 'branch-Level-6'
JustinnT Feb 22, 2020
b5438f7
Merge branch 'branch-Level-7'
JustinnT Feb 22, 2020
8ed8add
refractor code
JustinnT Feb 23, 2020
44c81f8
Increment more OOP
JustinnT Feb 23, 2020
20bfe89
Merge branch 'A-MoreOOP'
JustinnT Feb 23, 2020
c8c0737
added find for level-9
JustinnT Feb 23, 2020
2cc378d
added A-JavaDoc
JustinnT Feb 23, 2020
627e158
Merge pull request #2 from JustinnT/branch-level-9
JustinnT Feb 23, 2020
82331b2
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Feb 23, 2020
f42d5c9
Merge branch 'master' into A-JavaDoc
JustinnT Feb 23, 2020
1c3c54f
Merge pull request #3 from JustinnT/A-JavaDoc
JustinnT Feb 23, 2020
bb5dfa9
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Feb 23, 2020
43b53d6
fix index out of bounds exception for find command
JustinnT Feb 23, 2020
0f0c99a
A-packages
JustinnT Feb 23, 2020
bea671f
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Feb 24, 2020
b5b9c39
Moved into different packages
JustinnT Feb 24, 2020
ebc22c1
Set theme jekyll-theme-tactile
JustinnT Feb 24, 2020
83257dc
test user guide
JustinnT Feb 24, 2020
10826a5
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Feb 24, 2020
92e89ce
refractor variable name to reflect more accurately on what Find does
JustinnT Feb 24, 2020
84523ee
added custom error message for done command
JustinnT Feb 24, 2020
111afbb
add user guide
JustinnT Feb 24, 2020
8a03770
Suppress warnings
JustinnT Feb 29, 2020
f34c442
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Feb 29, 2020
e82c41f
Added content page for UG
JustinnT Mar 2, 2020
5f76081
Fix missing whitespace on '##' character
JustinnT Mar 2, 2020
48a8034
Fix formatting error
JustinnT Mar 2, 2020
2eb84ab
fix formatting error
JustinnT Mar 2, 2020
477c5d5
Fix more formatting error
JustinnT Mar 2, 2020
6743bcd
undo changes
JustinnT Mar 2, 2020
c56f850
Set theme jekyll-theme-architect
JustinnT Mar 2, 2020
adebdf5
Merge branch 'master' of https://github.com/JustinnT/duke
JustinnT Mar 3, 2020
02b0471
Removed utf 8 as windows cannot display it properly
JustinnT Mar 3, 2020
5ca80b4
Added custom delete error message
JustinnT Mar 3, 2020
4e1328c
Finished and removed todo comments
JustinnT Mar 3, 2020
98e313b
Remove todo comment
JustinnT Mar 3, 2020
ee23323
Updated UG to reflect changes in printing
JustinnT Mar 3, 2020
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ src/main/resources/docs/
.DS_Store
*.iml
bin/
text-ui-test/EXPECTED.txt
text-ui-test/input.txt
text-ui-test/runtest.bat
src/main/java/META-INF/MANIFEST.MF
data/duke.txt
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

# Tutorials

Duke Increment | Tutorial
duke.main.Duke Increment | Tutorial
---------------|---------------
`A-Gradle` | [Gradle Tutorial](tutorials/gradleTutorial.md)
`A-TextUiTesting` | [Text UI Testing Tutorial](tutorials/textUiTestingTutorial.md)
`Level-10` | JavaFX tutorials:<br>→ [Part 1: Introduction to JavaFX][fx1]<br>→ [Part 2: Creating a GUI for Duke][fx2]<br>→ [Part 3: Interacting with the user][fx3]<br>→ [Part 4: Introduction to FXML][fx4]
`Level-10` | JavaFX tutorials:<br>→ [Part 1: Introduction to JavaFX][fx1]<br>→ [Part 2: Creating a GUI for duke.main.Duke][fx2]<br>→ [Part 3: Interacting with the user][fx3]<br>→ [Part 4: Introduction to FXML][fx4]

[fx1]: <tutorials/javaFxTutorialPart1.md>
[fx2]: <tutorials/javaFxTutorialPart2.md>
Expand Down
201 changes: 195 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,209 @@
# User Guide
# Table of content
<!-- TOC -->
- [Introduction](#introduction)
- [Features](#features)
- [Usage](#usage)
- [View help: `help`](#help---prints-the-entire-list-of-command)
- [Exit duke: `bye`](#bye---exits-the-application)
- [Add todo task: `todo`](#todo---adds-a-todo-command-to-the-list)
- [Add event task: `event`](#event---adds-a-event-task-to-the-list)
- [Add deadline task: `deadline`](#deadline---adds-a-deadline-task-to-the-list)
- [View list: `list`](#list---prints-the-entire-list-of-tasks-added)
- [Mark as done: `done`](#done---marks-a-task-in-the-list-as-done)
- [Find specific task: `find`](#find---finds-all-tasks-that-contains-keyword)
- [Delete specific task: `delete`](#delete---delete-a-task-from-the-list)

<!-- TOC -->

## Introduction
Duke is a personal task manager that assist the user to keep track of their schedule. Running on a command line interface,
duke is designed for users who type fast and prefers a CLI interface as opposed to a GUI.
## Features

### Feature 1
Description of feature.
#### View help
Duke allows you to view its available commands within the application.

#### Keeps track of your tasks
With Duke, you can keep track of various tasks such as Todo, Event and Deadline tasks.

#### View all your tasks
Want to see what tasks you have done (or not yet done)? Duke can show you all your tasks you are currently tracking.

#### Mark your task as done
Done with a task? Duke allows you to mark a specific task as done.

#### Finding a specific task
Can't remember what task you've added? Duke allows you to filter tasks by searching for a keyword.

#### Auto-saves
Duke auto saves after any modifications to your tasks. So you do not have to worry about random
[crashes](https://en.wikipedia.org/wiki/Crash_(computing)) anymore!

## Usage

### `Keyword` - Describe action
### `help` - Prints the entire list of command.

List all commands that can be executed on the application

Example of usage:

`help`

Expected outcome:

![](help.PNG)

### `bye` - Exits the application.

Exits the application upon input of this command

Example of usage:

`bye`

Expected outcome:

![](bye.PNG)

### `todo` - Adds a `todo` command to the list.

Adds a `todo` task to the list. Upon successful addition of task,
a confirmation message will be printed.

Describe action and its outcome.
An error message will be printed if the supplied format is wrong.

Example of usage:

`keyword (optional arguments)`
* Correct format example: `todo homework`
* Incorrect format example: `todo `

Expected outcome:
* If successful

![](todo_success.PNG)

* If unsuccessful

![](todo_unsuccessful.PNG)

### `event` - Adds a `event` task to the list.

Adds a `event` task to the list. Upon successful addition of task,
a confirmation message will be printed.

An error message will be printed if the supplied format is wrong

Example of usage:

* Correct format example: `event team meeting /at NUS 3-4pm`
* Incorrect format example : `event team meeting at NUS 3-4pm`


Expected outcome:
* If successful

![](event_successful.PNG)

* If unsuccessful

![](event_unsuccessful.PNG)

### `deadline` - Adds a `deadline` task to the list.

Adds a `deadline` task to the list. Upon successful addition of task,
a confirmation message will be printed.

An error message will be printed if the supplied format is wrong

Example of usage:

`outcome`
* Correct format example : `deadline submit iP /by March 2`

* Incorrect format example : `deadline submit iP by March 2`

Expected outcome:
* If successful

![](deadline_successful.PNG)
* If unsuccessful

![](deadline_unsuccessful.PNG)

### `list` - Prints the entire list of tasks added.

Prints the entire list of tasks that was added by User.

Example of usage:

`list'

Expected outcome:

![](list.PNG)

### `done` - Marks a task in the list as done.

Marks a task at the specified index in the list as done.

Upon successful mark, a confirmation message will be printed.

An error message will be printed if the task does not exist

Example of usage:

* Correct format example: `done 1`
* Incorrect format example: `done 100000000000`

Expected outcome:
* If successful

![](done_successful.PNG)
* If unsuccessful

![](done_unsuccessful.PNG)

### `find` - Finds all tasks that contains keyword

Finds all tasks that matches supplied keyword exactly
or contains a substring of keyword.

If there are any tasks which matches the keyword,
a list will be printed out.

If there are no task that matches a keyword,
no matching tasks will be printed.

Example of usage:

* Matching usage example: `find homework`

* No matches usage example: `find homewk`

Expected outcome:

* If matches keyword

![](find_match.PNG)

* If no matches

![](find_no_match.PNG)

### `delete` - Delete a task from the list

Deletes a task at the specified index of the list

Upon successful mark, a confirmation message will be printed.

An error message will be printed if the task does not exist

Example of usage:

* Correct format example: `delete 1`
* Incorrect format example: `delete 100000000000`

Expected outcome:
* If successful: ![](delete_successful.PNG)
* If unsuccessful ![](delete_unsuccessful.PNG)

1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-architect
Binary file added docs/bye.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/deadline_successful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/deadline_unsuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/delete_successful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/delete_unsuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/done_successful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/done_unsuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/event_successful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/event_unsuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/find_match.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/find_no_match.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/help.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/list.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/todo_success.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/todo_unsuccessful.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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

import duke.printer.Printer;
import duke.storage.Storage;

import java.io.File;
import java.util.List;

/**
* Represents a "bye" command that user will input.
* A <code>duke.commands.ByeCommand</code> object will be executed when the User types in "bye" in the UI
* e.g., <code>bye</code>
*/
public class ByeCommand extends Command {

public void execute(Storage myTasks, File saveFile, List<String> commands, String command) {
Printer.printLines();
Printer.printIndentation();
Printer.printBye();
Printer.printLines();

System.exit(0);
}
}
32 changes: 32 additions & 0 deletions src/main/java/duke/commands/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package duke.commands;

import duke.parser.Parser;
import duke.storage.Storage;

import java.io.File;
import java.util.List;

/**
* A parent class for the various commands to inherit.
*/
public abstract class Command {
public static final List<String> COMMAND_LIST = Parser.getCommandList();
public static final int LIMIT = 2;
public static final int LIST_INDEX = 1;
public static final int TASK_DESCRIPTION = 1;
public static final int TASK_DESCRIPTION_AND_DATE = 1;
public static final int TASK_DEADLINE = 0;
public static final int TASK_EVENT_AT = 0;
public static final int DUKE_COMMAND = 0;

/**
* For children class to implement
*
* @param myTasks The list where children command will store Tasks.
* @param saveFile The place where children command will save Tasks.
* @param commands The rest of the description that has not been parsed yet. e.g., "team meeting /at central lib"
* @param command The actual command for the children. e.g., "deadline", "event".
*/
public abstract void execute(Storage myTasks, File saveFile, List<String> commands,
String command);
}
58 changes: 58 additions & 0 deletions src/main/java/duke/commands/DeadlineCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package duke.commands;

import duke.exceptions.BlankStringException;
import duke.exceptions.DukeExceptionHandler;
import duke.filemanager.FileSaver;
import duke.parser.Parser;
import duke.printer.Printer;
import duke.storage.Storage;
import duke.tasks.Deadline;

import java.io.File;
import java.util.List;

/**
* Represents a "deadline" command that user will input.
* A <code>duke.commands.DeadlineCommand</code> object will be executed when the User types in "deadline" in the UI
* e.g., <code>deadline</code> submit iP /by March 2
*/
public class DeadlineCommand extends Command {

/**
* Executes the deadline command.
*
* This method will first parse the description and deadline.
* Then stores it into the list and save it to the file.
* If User supplies the wrong format to the deadline command, error will be printed.
*
* @param myTasks The list to store the task.
* @param saveFile The filepath to save the task.
* @param commands The remaining descriptions that has not been parsed i.e. "submit iP /by March 2"
* @param command The exact command that was supplied for this method i.e. "deadline"
*/
public void execute(Storage myTasks, File saveFile, List<String> commands, String command) {
try {
String descriptionAndDeadline = commands.get(TASK_DESCRIPTION_AND_DATE);
List<String> separated = Parser.parseDeadlineDate(descriptionAndDeadline);

String description = separated.get(TASK_DESCRIPTION);
String deadline = separated.get(TASK_DEADLINE);
description = description.trim();
deadline = deadline.trim();

DukeExceptionHandler.isBlank(description);
DukeExceptionHandler.isBlank(deadline);

Deadline deadlineTask = new Deadline(description, deadline);
myTasks.storeTasks(deadlineTask);

FileSaver.saveFile(command, saveFile, description, deadline);

Printer.printConfirmationMessage(command, deadlineTask);

} catch (IndexOutOfBoundsException | BlankStringException e) {
Printer.printFormatError(command);
Printer.printHint(command);
}
}
}
Loading