Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a4564e4
rename "Duke" to "Luke", and added greetings
janelleenqi Sep 4, 2023
860d878
add echo feature
janelleenqi Sep 4, 2023
35b72fc
add features (add, list but reverse)
janelleenqi Sep 5, 2023
5fc8ba6
amend features (add, list)
janelleenqi Sep 5, 2023
8e02823
add feature (mark as done)
janelleenqi Sep 5, 2023
6b19f57
tweaks to follow naming conventions
janelleenqi Sep 5, 2023
aebc096
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
17570b2
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
10bcaae
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
b503333
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
5bae015
Added Text-UI-Testing
janelleenqi Sep 7, 2023
2702b6e
Revise formatting, Implement enum & switch
janelleenqi Sep 10, 2023
7796691
make Task an abstract task
janelleenqi Sep 17, 2023
39b457c
fix lines spaced part 2
janelleenqi Sep 17, 2023
573e246
fix lines spaced part 2
janelleenqi Sep 17, 2023
bf1f72b
remove unnecessary line
janelleenqi Sep 19, 2023
7087e36
IntelliJ recommendations
janelleenqi Sep 19, 2023
0609792
add some try-catch blocks
janelleenqi Sep 19, 2023
e41f732
add some try-catch blocks and throw-catch blocks
janelleenqi Sep 20, 2023
6c7aeb7
add try-catch blocks and throw-catch blocks for random words
janelleenqi Sep 20, 2023
4320721
change to more specific error message lines
janelleenqi Sep 20, 2023
f6e4a2d
change to even more specific error message lines and fix list error
janelleenqi Sep 20, 2023
5dc30d9
throw error if deadline format is wrong
janelleenqi Sep 20, 2023
e0a2e01
throw error if event format is wrong
janelleenqi Sep 20, 2023
3eb76bc
Merge branch 'branch-Level-5'
janelleenqi Sep 20, 2023
25200f0
divide classes into packages
janelleenqi Sep 20, 2023
746312f
fix lines
janelleenqi Sep 20, 2023
37b5bb1
Merge branch 'branch-A-packages'
janelleenqi Sep 20, 2023
ed9f860
use java collection classes, add "delete" action
janelleenqi Sep 21, 2023
022d97d
(notes: errors exist) adding memory storage using txt file
janelleenqi Sep 21, 2023
e51e000
ignore META-INF folder
janelleenqi Sep 21, 2023
36fcba8
write new memory into memory.txt, ignore META-INF folder
janelleenqi Sep 21, 2023
0641727
ignore META-INF folder
janelleenqi Sep 21, 2023
af7f54c
(still needs fixing) add read ability from existing file
janelleenqi Sep 21, 2023
0437cfb
(still needs fixing) able to read from file and write to file but una…
janelleenqi Sep 21, 2023
6494a32
.gitignore for memory.txt
janelleenqi Sep 21, 2023
52f898d
Merge branch 'branch-Level-6'
janelleenqi Sep 21, 2023
39ad792
resolved conflicts (same errors of can read, can write, but cannot us…
janelleenqi Sep 21, 2023
652c9b2
can use file data
janelleenqi Sep 21, 2023
51f7a9f
fix indentation
janelleenqi Oct 4, 2023
4bcd01d
fix indentation
janelleenqi Oct 4, 2023
801ed78
Add "find" ActionType
janelleenqi Oct 4, 2023
39eda3c
Add Objects (Ui & Parser)
janelleenqi Oct 5, 2023
18a6643
Add Objects (ExitCommand)
janelleenqi Oct 5, 2023
bf62341
Add Objects (DeleteCommand)
janelleenqi Oct 5, 2023
56321ce
Add Objects (ListCommand)
janelleenqi Oct 5, 2023
48815a3
Add Objects (FindCommand)
janelleenqi Oct 5, 2023
ef5a710
make more OOP but with errors
janelleenqi Oct 5, 2023
2da6307
Add Objects (MarkCommand)
janelleenqi Oct 5, 2023
49d2924
Fix Objects (Parser), to include instantiating child classes of Command
janelleenqi Oct 5, 2023
772d5cf
Add Objects (AddCommand)
janelleenqi Oct 5, 2023
f1b66a6
Add Abstract Class (Command)
janelleenqi Oct 5, 2023
364d48d
Fix Objects (Parser)
janelleenqi Oct 5, 2023
ad80c66
Add Objects (Storage)
janelleenqi Oct 5, 2023
1818f2f
Add Objects (TaskList)
janelleenqi Oct 5, 2023
3190778
Fix Objects (Ui)
janelleenqi Oct 5, 2023
b99923f
Fix Luke to get a code that can run
janelleenqi Oct 5, 2023
1109f04
Add "BYE" to ActionType, Add "BYE" case to Parser parse method, so th…
janelleenqi Oct 5, 2023
3ad68bf
Fix small errors
janelleenqi Oct 5, 2023
de661a4
Fix - "bye" ends Luke without scanner errors
janelleenqi Oct 5, 2023
a466466
Fix Retrieval of Memory (syntax)
janelleenqi Oct 5, 2023
4342a65
Print correct and specific error messages for errors
janelleenqi Oct 5, 2023
698d964
Fix spacing in memory storage/retrieval
janelleenqi Oct 5, 2023
41f428d
Code Organisation
janelleenqi Oct 5, 2023
3d28a78
Merge branch 'branch-A-MoreOOP'
janelleenqi Oct 5, 2023
b8fe251
Add JavaDoc comments
janelleenqi Oct 5, 2023
54c9b4c
Fix Level-9
janelleenqi Oct 5, 2023
afa9433
Merge pull request #1 from janelleenqi/branch-Level-9
janelleenqi Oct 5, 2023
3d45534
Merge branch 'master' into branch-A-JavaDoc
janelleenqi Oct 5, 2023
1845d33
Merge pull request #2 from janelleenqi/branch-A-JavaDoc
janelleenqi Oct 5, 2023
56970bd
Update docs\README.md
janelleenqi Oct 5, 2023
688c7da
Update docs\README.md part 2
janelleenqi Oct 5, 2023
3ed4739
Update docs\README.md part 3
janelleenqi Oct 6, 2023
a1a0256
Update docs\README.md part 4
janelleenqi Oct 6, 2023
f21791f
Update Level 7 Save: Luke runs even if no memory.txt exists
janelleenqi Oct 6, 2023
e1e19fb
Update Level 7 Save: Luke runs even if no memory.txt exists part 2
janelleenqi Oct 6, 2023
5c566bd
Update Level 7 Save: directory "data" is created and file "memory.txt…
janelleenqi Oct 6, 2023
2e094bf
Rename LukeTimeError to LukeException
janelleenqi Oct 6, 2023
4e9d393
Refine error from invalid user input
janelleenqi Oct 6, 2023
05973a4
Catch NumberFormatException errors for delete, mark and unmark
janelleenqi Oct 6, 2023
2294806
Refine error messages
janelleenqi Oct 6, 2023
bfe863a
Add user guide within Luke application
janelleenqi Oct 6, 2023
bef32d4
Edit JavaDoc Comments
janelleenqi Oct 6, 2023
bd4a715
Minor Edit
janelleenqi Oct 6, 2023
e27b225
Fix Memory Saving for Task Completion Status
janelleenqi Oct 6, 2023
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 @@ -15,3 +15,8 @@ bin/

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

/src/main/java/META-INF

/data
/data/memory.txt
200 changes: 190 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,209 @@
# User Guide
# User Guide for Luke

## Features

### Feature-ABC
### Task List

Description of the feature.
Luke keeps a task list of all the todo, deadlines and events.

### Feature-XYZ
### Mark as Completed/Incomplete

Description of the feature.
You can mark tasks as completed or incompleted.

### Store Memory

When closing Luke, all current tasks are stored in a txt file.
The next time Luke is opened, all tasks in the txt file is loaded back into Luke.

## Usage

### `Keyword` - Describe action

Describe the action and its outcome.
### `todo` - Add todo

Add new task (todo) to your list.

Format of usage:

`todo DESCRIPTION`

Example of usage:

`todo read book`

Expected outcome:

New todo task added, so there will be a confirmation message.

```
Got it. I've added this task:
[T][ ] read book
Now you have 1 tasks in the list.
```

### `deadline` - Add deadline

Add new task (deadline) to your list.

Format of usage:

`deadline DESCRIPTION /by DATE`

Example of usage:

`deadline return book /by next saturday`

Expected outcome:

New deadline task added, so there will be a confirmation message.

```
Got it. I've added this task:
[D][ ] return book (do by: next saturday)
Now you have 2 tasks in the list.
```

### `event` - Add event

Add new task (event) to your list.

Format of usage:

`event DESCRIPTION /from STARTDATE /to ENDDATE`

Example of usage:

`event reading club session /from friday 4 /to 6pm`

Expected outcome:

New event task added, so there will be a confirmation message.

```
Got it. I've added this task:
[E][ ] reading club session (from: friday 4 to: 6pm)
Now you have 1 tasks in the list.
```

### `list` - Lists all tasks

Lists all tasks in the task list.

Example of usage:

`keyword (optional arguments)`
`list`

Expected outcome:

This will display all your tasks, including their type (todo, deadline, event), their task description and their status (completed or not).

```
Here are the tasks in your list:
1. [T][ ] read book
2. [D][ ] return book (do by: next saturday)
3. [E][ ] reading club session (from: friday 4 to: 6pm)
```

### `mark` - Mark a task as completed

Mark a task as completed using the "mark" command followed by the task number.

Format of usage:

`mark INDEX`

Example of usage:

`mark 1`

Expected outcome:

This will mark the task with index 1 as completed.

```
Woohoo! You have accomplished:
[T][X] read book
```

### `unmark` - Mark a task as incomplete

Mark a task as incomplete using the "unmark" command followed by the task number.

Format of usage:

`unmark INDEX`

Example of usage:

`unmark 1`

Expected outcome:

This will mark the task with index 1 as incomplete.

```
HA! You still have to complete:
[T][ ] read book
```


### `find` - Find user's input in tasks descriptions

Show the corresponding tasks.

Format of usage:

`find KEYWORD`

Example of usage:

`find book`

Expected outcome:

List of tasks that have descriptions matching the user's input.

```
Here are the matching tasks in your list:
1. [T][ ] read book
2. [D][ ] return book (do by: next saturday)
```

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

To delete a task from your list, use the "delete" command followed by the task number.

Format of usage:

`delete INDEX`

Example of usage:

`delete 2`

Expected outcome:

This will remove the task with index 2 from your list.


```
Noted. I've removed this task:
[D][ ] return book (do by: next saturday)
Now you have 2 tasks in the list.
```

### `bye` - Close Luke

Close Luke and store memory to a txt file.

Example of usage:

`bye`

Expected outcome:

Description of the outcome.
Message whether memory is stored safely, and Luke is closed.

```
expected output
Memory Stored Safely!
Bye. Hope to see you again soon!
```
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

71 changes: 71 additions & 0 deletions src/main/java/Luke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

import luke.actions.*;
import luke.user.LukeException;
import luke.user.Ui;
import luke.tasks.*;
import luke.files.*;

/**
* The Luke Class represents the main application class for Luke, a task management application.
* It initializes the user interface, task storage and task list.
* It runs the application loop, managing the user interface, task storage, and task list.
*/
public class Luke {
public static final String folderPath = "data";

private Storage storage;
private TaskList tasks;
private Ui ui;

/**
* Constructs a Luke object.
*/
public Luke() {
ui = new Ui();
storage = new Storage(folderPath);
try {
tasks = new TaskList(storage.load());
} catch (LukeException e) {
ui.showLoadingError();
tasks = new TaskList();
} catch (NullPointerException e) {
//ui.showNoMemoryFileError();
tasks = new TaskList();
}
}

/**
* Runs the Luke application.
* It displays a welcome message, reads user commands, and executes corresponding actions.
* The application continues running until the user exits.
*/
public void run() {
ui.showWelcome();
boolean isExit = false;
while (!isExit) {
try {
String fullCommand = ui.readCommand();
ui.showLine(); // show the divider line ("_______")
Command c = Parser.parse(fullCommand);
//c has theActionWord and parameters
c.execute(tasks, ui, storage);
//tasks has ArrayList<Task> mainTaskList, ui has String echo, storage has ArrayList<Task> tasks
isExit = c.isExit(); //for bye command
} catch (LukeException e) { //from Parser.parse
ui.showError("\t☹ An error occurred." + e.getMessage());
} finally {
ui.showLine();
}
}
}

/**
* The main method that starts the Luke application.
*
* @param args The command-line arguments (not used in this application).
*/
public static void main(String[] args) {
new Luke().run();
}
}

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

/**
* The ActionType enum represents the various types of actions that can be performed in the LukeTime application.
* Each action corresponds to a specific user command.
*/
public enum ActionType {
LIST, FIND, MARK, UNMARK, TODO, DEADLINE, EVENT, DELETE, BYE
}
67 changes: 67 additions & 0 deletions src/main/java/luke/actions/AddCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package luke.actions;

import luke.files.Storage;
import luke.tasks.*;
import luke.user.LukeException;
import luke.user.Ui;

import static luke.actions.ActionType.*;

/**
* The AddCommand Class represents a command for adding a task to the Luke application.
* It extends the Command class and includes specific behavior for adding different types of tasks.
*/
public class AddCommand extends Command {

/**
* The latest task created as a result of the add command.
*/
private Task latestTask;

/**
* Constructs an AddCommand with the specified action type and parameters.
*
* @param theAction The action type (TODO, DEADLINE, EVENT).
* @param parameters The parameters provided with the command (task description or task details).
* @throws LukeException If there are missing or invalid arguments for creating the task.
*/
public AddCommand(ActionType theAction, String parameters) throws LukeException {

super(theAction, parameters);
if (theAction == TODO) {
latestTask = new Todo(parameters);
}
if (theAction == DEADLINE) {
try {
latestTask = new Deadline(parameters);
} catch (LukeException e) {
System.out.println("\t☹ OOPS!!! You have missing/invalid arguments for deadline. No changes have been made.");
throw new LukeException();
}
}
if (theAction == EVENT) {
try {
latestTask = new Event(parameters);
} catch (LukeException e) {
System.out.println("\t☹ OOPS!!! You have missing/invalid arguments for event. No changes have been made.");
throw new LukeException();
}
}

}

/**
* Executes the AddCommand to add the latest task to the task list.
*
* @param tasks The task list to which the task will be added.
* @param ui The user interface for displaying messages.
* @param storage The storage for saving task changes (not used in this case).
*/
@Override
public void execute(TaskList tasks, Ui ui, Storage storage) {
tasks.addTask(latestTask);

System.out.println("\tGot it. I've added this task:" + "\n" + tasks.get(tasks.size() - 1));
System.out.println("\tNow you have " + tasks.size() + " tasks in the list.");
}
}
Loading