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

IP #355

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open

IP #355

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2ca6b28
JavaFX tutorial: Support cross-platform JARs
j-lum Sep 20, 2019
6f2ddfa
Merge pull request #35 from j-lum/xplatformjfx
j-lum Feb 3, 2020
2697ae1
Remove unnecessary override annotation
jiachen247 Feb 11, 2020
1416279
Merge pull request #41 from jiachen247/patch-2
j-lum Feb 12, 2020
71d7ea8
Remove generic tutorials
May 24, 2020
ef3c8cd
Add text-ui-test files
May 24, 2020
87eb8b8
README.md: Fix typo of => or
damithc Jul 3, 2020
569941e
add greet functionality
abnermtj Aug 19, 2020
58b01ea
add echo functionality
abnermtj Aug 26, 2020
d230588
add listing
abnermtj Aug 26, 2020
9001c6d
add finishing tasks
abnermtj Aug 26, 2020
c5684ba
change code variable names
abnermtj Aug 26, 2020
1d08529
add new Task subclasses ToDos, Events, Deadlines
abnermtj Sep 1, 2020
7d5a549
add basic testing
abnermtj Sep 1, 2020
b81f997
reduce linecount on verbose functions
abnermtj Sep 1, 2020
54a7a82
Fix Coding Standard violations
abnermtj Sep 2, 2020
3694276
fix formatting issues
abnermtj Sep 2, 2020
7857322
refactor duke.java
abnermtj Sep 2, 2020
6ec71a5
update gitignore
abnermtj Sep 8, 2020
86b9bdb
add DukeExceptions and handling
abnermtj Sep 8, 2020
bf94a80
Merge branch 'branch-Level-5'
abnermtj Sep 8, 2020
6a05692
created packages and updated testing
abnermtj Sep 8, 2020
b349939
Merge branch 'branch-A-Packages'
abnermtj Sep 8, 2020
377ef17
add delete function
abnermtj Sep 13, 2020
532842e
add save function
abnermtj Sep 13, 2020
4e0facb
Merge branch 'branch-Level-6'
abnermtj Sep 14, 2020
9548884
Merge branch 'branch-Level-7'
abnermtj Sep 14, 2020
417a070
refactor code
abnermtj Sep 16, 2020
c7ca30f
refactor Exception messages
abnermtj Sep 23, 2020
cf60ebf
add comments
abnermtj Sep 23, 2020
615c04b
Refactor to more OOP style
abnermtj Sep 24, 2020
49fe2bc
Add date time recognizing
abnermtj Sep 25, 2020
69c66ec
add find method
abnermtj Sep 25, 2020
925d447
add javadocs
abnermtj Sep 25, 2020
43849b1
Merge pull request #2 from abnermtj/branch-Level-8
abnermtj Sep 25, 2020
5cde6a5
resolve merge conflict
abnermtj Sep 25, 2020
8db68f8
Mer branch 'master' of github.com:abnermtj/ip
abnermtj Sep 25, 2020
12e8473
Merge pull request #4 from abnermtj/branch-A-JavaDoc
abnermtj Sep 25, 2020
2db9678
Merge branch 'master' of github.com:abnermtj/ip
abnermtj Sep 25, 2020
fd5279f
Merge branch 'master' into branch-Level-9
abnermtj Sep 25, 2020
4e43dd0
Merge pull request #3 from abnermtj/branch-Level-9
abnermtj Sep 25, 2020
e889556
fix merging mistakes
abnermtj Sep 25, 2020
f7df174
code refactoring
abnermtj Sep 25, 2020
c093875
add userguide
abnermtj Sep 26, 2020
e151110
Update README.md
abnermtj Sep 26, 2020
41b32f3
Update README.md
abnermtj Sep 26, 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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ src/main/resources/docs/
.DS_Store
*.iml
bin/

/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT

# Vim files
*.swp
*.un~

68 changes: 29 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
# Setting up

**Prerequisites**

* JDK 11
* Recommended: IntelliJ IDE
* Fork this repo to your GitHub account and clone the fork to your computer

**Importing the project into IntelliJ**

1. Open IntelliJ (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first).
1. Set up the correct JDK version.
* Click `Configure` > `Structure for new Projects` (in older versions of Intellij:`Configure` > `Project Defaults` > `Project Structure`).
* If JDK 11 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 11.
* Click `OK`.
1. Click `Import Project`.
1. Locate the project directory and click `OK`.
1. Select `Create project from existing sources` and click `Next`.
1. Rename the project if you want. Click `Next`.
1. Ensure that your src folder is checked. Keep clicking `Next`.
1. Click `Finish`.

# Tutorials

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]

[fx1]: <tutorials/javaFxTutorialPart1.md>
[fx2]: <tutorials/javaFxTutorialPart2.md>
[fx3]: <tutorials/javaFxTutorialPart3.md>
[fx4]: <tutorials/javaFxTutorialPart4.md>

# Feedback, Bug Reports

* If you have feedback or bug reports, please post in [se-edu/duke issue tracker](https://github.com/se-edu/duke/issues).
* We welcome pull requests too.
# Notes
Minimally, commit after completing each increment.

# Duke 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.

## Setting up in Intellij

Prerequisites: JDK 11, update Intellij to the most recent version.

1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first)
1. Set up the correct JDK version, as follows:
1. Click `Configure` > `Structure for New Projects` and then `Project Settings` > `Project` > `Project SDK`
1. If JDK 11 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 11
1. Click `OK`
1. Import the project into Intellij as follows:
1. Click `Open or Import`.
1. Select the project directory, and click `OK`
1. If there are any further prompts, accept the defaults.
1. After the importing is complete, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below:
```
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
```
8 changes: 8 additions & 0 deletions data/tasksList.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
event|true|asds|2222-12-13|
deadline|false|asddssssssss|2222-10-23|
event|false|asdads|1231-12-22|
deadline|false|asdadssaas|1225-12-12|
todo|true|123|
todo|true|find my dog|
event|false|visit my cat|2021-11-12|
deadline|false|adopt a cat|2021-11-11|
152 changes: 146 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,160 @@

# User Guide

## Features

### Feature 1
Description of feature.
### Duke is a platform to compile and organize your tasks.
Keeping track of todos, event and deadlines that you add. Duke can show a list of all the tasks that you need to do and provide useful commands to mark them as done, delete or find tasks.

### Duke automatically saves and loads your tasks
You can always come back later to find your last session automatically loaded without having to type additional commands. Tasks are also stored in plaintext for easy manipulation.

## Usage

### `Keyword` - Describe action
### `todo <desc>` - Add a todo item

Adds a todo item and gives it the description \<desc> , then adds it to the list of tasks.

A succesful addition will show a message indicating the task just added and the number of items in the list after adding it.

Example of usage:

`todo find my dog`

Expected outcome:
```
---------------------------------------
Got it. I've added this task:
[T][✘] find my dog
Now you have n task(s) in the list.
---------------------------------------
```

### `deadline <desc> /by <dueDate>` - Add a deadline item

Adds a deadline item and gives it the description \<desc> then and a due date of \<dueDate>, then adds it to the list of tasks.

A succesful addition will show a message indicating the task just added, its dueDate and the number of items in the list after adding it.

\<dueDate > must be formatted as YYYY-MM-DD.

Example of usage:

`deadline adopt a cat /by 2021-11-11`

Expected outcome:
```
---------------------------------------
Got it. I've added this task:
[D][✘] adopt a cat (by: Nov 11 2021)
Now you have n task(s) in the list.
---------------------------------------
```

### `event <desc> /at <startDate>` - Add an event item

Adds a event item and gives it the description \<desc> then and a start time of \<startDate>, then adds it to the list of tasks.

A succesful addition will show a message indicating the task just added, its startDate and the number of items in the list after adding it.

\<startDate> must be formatted as YYYY-MM-DD.

Example of usage:

`event visit my cat /at 2021-11-12`

Expected outcome:
```
---------------------------------------
Got it. I've added this task:
[E][✘] visit my cat (at: Nov 12 2021)
Now you have n task(s) in the list.
---------------------------------------
```

### `delete <desc>` - Delete a task

Deletes the first instance of a task in the list of tasks with a matching description to \<desc>. If no matches are found Duke will print a message that the task was not found else it will print the details of the task just deleted and the number of remaining tasks after deletion.

Example of usage:

`delete find my dog`

Expected outcome:
```
---------------------------------------
Got it. I've deleted this task:
[T][✓] find my dog
Now you have 8 task(s) in the list.
---------------------------------------
```

### `done <desc>` - Mark a task as done

Marks done the first instance of a task in the list of tasks with a matching description to \<desc>. If no matches are found Duke will print a message that the task was not found else it will print the details of the task just marked.

A done task has a [✓] indicated just before the task description. Otherwise it would be a [✘].

Example of usage:

`done find my dog`

Expected outcome:
```
---------------------------------------
done find my dog
Nice! I've marked this task as done:
[T][✓] find my dog
------------------------------
```


### `find <desc>` - List all tasks with a matching description

Finds all task in the list of tasks that match the string \<desc>. Descriptions which have \<desc> as a substring are also considered a match. Duke prints all the tasks that match as well as their descriptions.

Describe action and its outcome.
Example of usage:

`find cat`

Expected outcome:
```
---------------------------------------
Here are the matching tasks in your list
1.[E][✘] visit my cat (at: Nov 12 2021)
2.[D][✘] adopt a cat (by: Nov 11 2021)
---------------------------------------
```

### `list` - List all tasks and their descriptions

Finds all task in the list of tasks that match the string \<desc>. Descriptions which have \<desc> as a substring are also considered a match. Duke prints all the tasks that match.

Example of usage:

`keyword (optional arguments)`
`list`

Expected outcome:
```
---------------------------------------
1.[T][✘] find my dog
2.[E][✘] visit my cat (at: Nov 12 2021)
3.[D][✘] adopt a cat (by: Nov 11 2021)
---------------------------------------
```


### `bye` - Exit Duke

Exit the program.

Example of usage:

`bye`

Expected outcome:
```
Bye. Hope to see you again soon!
```


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

This file was deleted.

3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: duke.Duke

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

import duke.command.Command;
import duke.io.CommandParser;
import duke.task.TasksList;
import duke.io.Ui;
import duke.io.Storage;

import duke.exception.DukeException;

/**
* Manages Duke. It loops getting user input commands and executing them.
*/
public class Duke {
public static final String TASKS_LIST_SAVE_PATH = "data/tasksList.txt";

public static TasksList tasks;
public static Ui ui;
public static Storage storage;

public static boolean programIsRunning = true;

/**
* Starting method of the program
* @param args Arguments provided by the user when first starting the program
*/
public static void main(String[] args) {
enter();
mainLoop();
exit();
}

/**
* Initializes various common objects that are passed as parameters to commands.
* Greets the user.
*/
public static void enter() {
ui = new Ui();
storage = new Storage(TASKS_LIST_SAVE_PATH);
try {
tasks = storage.loadTasksList();
ui.printDataLoadSuccess();
} catch (DukeException e) {
ui.handleException(e);
tasks = new TasksList();
}

ui.printHomeScreen();
}

/**
* A continuous loop that runs as long as the program is running.
* Asks for user input which is parsed to generate a command object
* following a Command Pattern. These commands are then executed.
* This process loops till program is made to exit.
*
* This program also handle exception throw by command execution.
*/
public static void mainLoop() {
while(programIsRunning) {
try{
String input = ui.getInput();
String[] separatedInput = ui.separateCommandAndArguments(input);
Command command = CommandParser.parseCommand(separatedInput);
command.execute(tasks, ui ,storage);

if (command.isExit) {
break;
}
} catch(DukeException exception) {
ui.handleException(exception);
}
}
}

/**
* Exits the Program and says goobye to user
*/
public static void exit() {
programIsRunning = false;
ui.printExitScreen();
}
}
Loading