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

Ananda Lye iP #65

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f4af9fa
Level 0. Greet
ananda-lye Jan 27, 2020
36e9b75
Level 1. Greet, Echo, Exit
ananda-lye Jan 27, 2020
20de280
Level 2. Add, List
ananda-lye Jan 27, 2020
d454993
Level-3: Mark as Done
ananda-lye Jan 28, 2020
e5e44cd
Level-3: Mark as Done (fixed response bug)
ananda-lye Jan 28, 2020
6382975
Fixed Coding Standard Violation
ananda-lye Feb 4, 2020
69c2051
Level 4. ToDos, Events, Deadlines
ananda-lye Feb 4, 2020
d4e6715
Level 4. ToDos, Events, Deadlines
ananda-lye Feb 4, 2020
374e891
Quick Fix Solution only.
ananda-lye Feb 12, 2020
b716134
Minimal Solution for A-Packages
ananda-lye Feb 12, 2020
01fac6a
Quick-Fix solution
ananda-lye Feb 12, 2020
ad87997
Merge branch 'branch-Level-5'
ananda-lye Feb 12, 2020
e3eac76
Converted to Switch statements, simplified Tokenization. Still lackin…
ananda-lye Feb 16, 2020
110af11
Fixed arrow-head violation
ananda-lye Feb 16, 2020
b51628a
Added Error Handling
ananda-lye Feb 16, 2020
16a69ff
Level-6 Included delete instruction and implemented as ArrayList
ananda-lye Feb 16, 2020
a5fc679
no message
ananda-lye Feb 22, 2020
10dfbdf
completed level-7 properly
ananda-lye Feb 22, 2020
5ed657a
completed level-7 properly again
ananda-lye Feb 22, 2020
b989408
changed filepath to an absolute
ananda-lye Feb 22, 2020
31e4c3e
level-9 added "find" function
ananda-lye Feb 23, 2020
3c8e855
Created More OOP Classes
ananda-lye Feb 24, 2020
279c74f
More OOP incomplete
ananda-lye Feb 24, 2020
13a6c1c
added TaskList class
ananda-lye Feb 24, 2020
0b3f933
Partial JavaDocs
ananda-lye Feb 29, 2020
67d87bd
JavaDocs more complete. Bug Found.
ananda-lye Feb 29, 2020
99c7b17
fixed bug - tentative solution
ananda-lye Feb 29, 2020
78b4752
Complete JavaDocs and fixed bug of out of bounds indexes
ananda-lye Mar 1, 2020
66c26ad
Completed JavaDoc, Jar and User Guide
ananda-lye Mar 1, 2020
f88b4c9
added more JavaDoc
ananda-lye Mar 1, 2020
0ba4500
Fixed typo in Readme
ananda-lye Mar 1, 2020
e868f96
Update README.md
ananda-lye Mar 2, 2020
e8b94c4
Update README.md
ananda-lye Mar 2, 2020
34826cc
Testing update
ananda-lye Mar 2, 2020
46a26b3
Fixed formatting issues
ananda-lye Mar 2, 2020
d6c44f4
Attempt fix
ananda-lye Mar 2, 2020
7862155
Attempt Fix
ananda-lye Mar 2, 2020
0bb1127
attempt fix
ananda-lye Mar 2, 2020
340cd7b
Update README.md
ananda-lye Mar 2, 2020
fa99f5b
Final Attempt to fix formatting
ananda-lye Mar 2, 2020
be493f3
Update README.md
ananda-lye Mar 2, 2020
e72ccd1
Fixed Final
ananda-lye Mar 2, 2020
0894cb3
fixed bye command highlighting
ananda-lye Mar 2, 2020
8b25f16
Changed tick and cross symbols. Accounted for invalid indexes.
ananda-lye Mar 3, 2020
58b9221
Fixed bug with empty 'find' description
ananda-lye Mar 3, 2020
e93cada
Merge branch 'master' of https://github.com/ananda-lye/duke
ananda-lye Mar 3, 2020
c069fa0
Updated UserGuide, undo README replace
ananda-lye Mar 3, 2020
95f8b2b
FIx Boolean function coding standard violation
ananda-lye 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
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.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.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
3 changes: 3 additions & 0 deletions data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0|Career Fair|E|26-02-2020
0|English Essay|D|26 Feb
0|CS2105 Assignment|D|next week
151 changes: 140 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,149 @@
# User Guide
# Introduction

## Features
Duke is a command-line interface task manager. You can use Duke to manage a list of to-do items, upcoming deadlines, and upcoming events. The list is saved upon exit and will be loaded upon the next session of Duke.

### Feature 1
Description of feature.
# Features

## Usage
This section describes the features that Duke supports.

### `Keyword` - Describe action
<b>NOTE:</b>
* Commands have to be the first word of the user input and in lower case
* Words in ```UPPER_CASE``` are the parameters to be supplied by the user

Describe action and its outcome.

Example of usage:
## 1. Adding New Tasks

`keyword (optional arguments)`
New tasks can be added by typing the command relevant to the type of task that is to be added (i.e. ```todo```,``` event``` or ```deadline```).

Expected outcome:
#### 1.1 Adding New To-Dos: ```todo```
- Adds a new to-do item to the task list.
- Format: ```todo NAME_OF_TASK```
- Examples:
- ```todo Math Online Quiz```
- ```todo CS2113 Homework```
- Expected Output:
```
todo CS2113 Homework
____________________________________________________________
Got it. I've added this task:
[T][X] CS2113 Homework
Now you have 2 tasks in the list.
____________________________________________________________
```

`outcome`
#### 1.2 Adding New Events: ```event```
- Adds a new event to the task list.
- Format: ```event NAME_OF_EVENT /at DATE_OF_EVENT```
- Examples:
- ```event Career Fair /at 26-02-2020```
- ```event Family Gathering /at 26 Feb```
- ```event Computing Convention /at Next Month```
- Expected Output:
```
event Career Fair /at 26-02-2020
____________________________________________________________
Got it. I've added this task:
[E][X] Career Fair (at: 26-02-2020)
Now you have 3 tasks in the list.
____________________________________________________________
```

#### 1.3 Adding New Deadlines: ```deadline```
- Adds a new deadline to the task list.
- Format: ```deadline NAME_OF_DEADLINE /by DATE_OF_DEADLINE```
- Examples:
- ```deadline Math Online Quiz /by 26-02-2020```
- ```deadline English Essay /by 26 Feb```
- ```deadline CS2113 Homework /by Tomorrow```
- Expected Output:
```
deadline English Essay /by 26 Feb
____________________________________________________________
Got it. I've added this task:
[D][X] English Essay (by: 26 Feb)
Now you have 4 tasks in the list.
____________________________________________________________
```

## 2. Listing All Tasks: ```list```
- Lists all task in the list.
- Format: ```list```
- Expected Output:
```
list
1.[T][O] CS2113 Homework
2.[E][X] Career Fair (at: 26-02-2020)
3.[D][X] English Essay (by: 26 Feb)
```

## 3. Finding Tasks by Keyword: ```find```
- Lists all task in the list that contains the specified keyword.
- Format: ```find KEYWORD```
- Examples:
- ```find Math```
- ```find CS2113```
- ```find CS```

- Expected Output:
```
find CS
____________________________________________________________
Here are the matching tasks in your list:

1.[T][X] CS2113 Homework
2.[D][X] CS2105 Assignment (by: next week)
____________________________________________________________
```

## 4. Marking Tasks as Done: ```done```
- Marks specified tasks as done.
- Specified index of the task will be its index of the entire task list by default, unless the ```list``` or ```find``` command has been called. In which case, it will be the index of the item as shown in the last shown list.
- Format: ```done INDEX```
- Examples:
- ```done 1```
- ```done 2```
- Expected Output:
```
done 1
Nice! I've marked this task as done:
[O] CS2113 Homework
```

## 5. Deleting Tasks: ```delete```
- Delete specified tasks from the list.
- Specified index of the task will be its index of the entire task list by default, unless the ```list``` or ```find``` command has been called. In which case, it will be the index of the item as shown in the last shown list.
- Format: ```done INDEX```
- Examples:
- ```delete 1```
- ```delete 2```
- Expected Output:
```
delete 1
____________________________________________________________
Noted. I've removed this task:
[T][O] CS2113 Homework
Now you have 3 tasks in the list.
____________________________________________________________

```

## 6. Loading Tasks from File
- Loading of tasks will be done automatically upon starting the application when there is a saved file present in the same directory of the Duke application. The file has the name ```data.txt```.
- Expected Output:
```
Previous tasks has been loaded successfully:
____________________________________________________________
1.[E][X] Career Fair (at: 26-02-2020)
2.[D][X] English Essay (by: 26 Feb)
3.[D][X] CS2105 Assignment (by: next week)
```

## 7. Saving Tasks: ```bye```
- Saving the state of the task list is done automatically when the program is exited using the ```bye`` command.
- Format: ```bye```
- Expected Output:

```
bye
Bye. Hope to see you again soon!
```
3 changes: 3 additions & 0 deletions saved/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1|something|T
0|some date|D|tmr
0|some lame thing|E|ytd
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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

/**
* Represents a deadline object which is a task with a deadline date associated with it.
*/
public class Deadline extends Task {
protected String by;

/**
* Constructor for a new deadline.
* @param description description for the deadline
* @param by the date for the deadline
*/
public Deadline(String description, String by) {
super(description);
this.by = by;
}

/**
* Constructor for deadlines that are read from a storage file.
* @param description description of the deadline
* @param by date of the deadline
* @param status status of the deadline
*/
public Deadline(String description, String by, String status) {
super(description);
this.by = by;
if (status.equals("1")) {
this.markAsDone();
}
}

/**
* @return a string containing the status, description and date of the deadline for printing
*/
@Override
public String toString() {
return "[D]" + super.toString() + " (by: " + this.by + ")";
}

/**
* @return a string of information of the deadline in the format for saving to a file
*/
@Override
public String toSaveFormat() {
return(super.toSaveFormat() + "D|" + this.by);
}
}
43 changes: 43 additions & 0 deletions src/main/java/Duke/Duke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package Duke;

import java.util.Scanner;
import java.util.ArrayList;
import java.io.File;
import java.io.FileNotFoundException;

/**
* Represents the Duke task manager.
*/
public class Duke {

public static final String GREETING =
"\n" +
" ___ _ \n" +
" | \\ _ _| |_____ \n" +
" | |) | || | / / -_)\n" +
" |___/ \\_,_|_\\_\\___|\n" +
" \n" +
"Hello! I'm Duke\n" + "What can I do for you?\n" +
"____________________________________________________________\n";
public static final String GOODBYE = "Bye. Hope to see you again soon!";
public static final String FILEPATH = "data.txt";

public static void main(String[] args) {
System.out.println(GREETING);

File f = new File(FILEPATH);

TaskList taskArray = new TaskList();

try {
Storage.loadFileContents(FILEPATH, taskArray);
Ui.printTasks(taskArray);
} catch (FileNotFoundException e) {
System.out.println("No saved file available");
}

Scanner scanner = new Scanner(System.in);

Parser.parseUserCommands(taskArray, scanner);
}
}
4 changes: 4 additions & 0 deletions src/main/java/Duke/DukeException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package Duke;

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

/**
* Represents an event-based task happening at a specific date.
*/
public class Event extends Task {
protected String at;

/**
* Constructor for a new event.
* @param description description for the event
* @param at date of the event
*/
public Event(String description, String at) {
super(description);
this.at = at;
}

/**
* Constructor for an event that is read from a storage file.
* @param description description of the event
* @param at date of the event
* @param status status of the event
*/
public Event(String description, String at, String status) {
super(description);
this.at = at;
if (status.equals("1")) {
this.markAsDone();
}
}

/**
* @return a string containing the status, description and date of the event for printing
*/
@Override
public String toString() {
return "[E]" + super.toString() + " (at: " + this.at + ")";
}

/**
* @return a string of information of the event in the format for saving to a file
*/
@Override
public String toSaveFormat() {
return(super.toSaveFormat() + "E|" + this.at);
}
}
Loading