-
Notifications
You must be signed in to change notification settings - Fork 77
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
[ishitamandal06] iP #71
Open
ishitamandal06
wants to merge
18
commits into
nus-cs2113-AY2223S1:master
Choose a base branch
from
ishitamandal06:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
812b9de
level 0
ishitamandal06 9a8d258
level 1
ishitamandal06 9fa13dc
level 2
ishitamandal06 fafcfeb
level-3
ishitamandal06 761792c
level-4
ishitamandal06 2eeed1b
level-5
ishitamandal06 4d4fce0
level-6
ishitamandal06 6ff3917
level-7
ishitamandal06 52bf70d
merge branch-level-7
ishitamandal06 64bcb9d
more OOP - Tasklist,Parser,UI class
ishitamandal06 eb1a81e
level-9
ishitamandal06 16aa926
Merge pull request #1 from ishitamandal06/branch-level-9
ishitamandal06 67058f8
A-JavaDoc
ishitamandal06 f01a4dc
A-UserGuide
ishitamandal06 0ecc751
update JavaDoc
ishitamandal06 868e212
A-JAR
ishitamandal06 302bf5b
bug fixes - JAR
ishitamandal06 9583209
adding jar file to main folder
ishitamandal06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[T][ ] read book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,208 @@ | ||
# User Guide | ||
|
||
Duke is a **Command Line Interface** (CLI) based desktop application which | ||
will help the user plan their tasks. It allows users to add or delete three categories of tasks: todos, deadlines, | ||
and events. They can mark these as done or not done and can also see a list of their tasks at | ||
any particular point in time. Additionally, they can search for all tasks containing a particular keyword. | ||
The application will save the tasks and reload them every time the user restarts the application so it can store the list as a memory. | ||
## Features | ||
|
||
### Feature-ABC | ||
### Feature - add a task | ||
Adds a task to the current list of tasks. The task could either be a todo, a deadline, or an event. | ||
|
||
Description of the feature. | ||
### Feature - delete a task | ||
|
||
### Feature-XYZ | ||
Deletes a task from the current list of tasks. | ||
|
||
Description of the feature. | ||
### Feature - list all tasks | ||
|
||
## Usage | ||
Lists all tasks present in the current list. | ||
|
||
### `Keyword` - Describe action | ||
### Feature - mark a task | ||
|
||
Describe the action and its outcome. | ||
Marks a particular task from the list as done | ||
|
||
Example of usage: | ||
### Feature - unmark a task | ||
|
||
`keyword (optional arguments)` | ||
Marks a particular task from the list as not done | ||
|
||
Expected outcome: | ||
### Feature - find tasks | ||
|
||
Description of the outcome. | ||
Finds all tasks present in the current list that contain the word entered by the user | ||
|
||
## Usage (An example workflow) | ||
|
||
## `todo` - Adds a todo to the collection of tasks | ||
|
||
#### *General format of command* | ||
todo DESCRIPTION_OF_TASK | ||
#### *Example of usage:* | ||
|
||
`todo read book` | ||
|
||
#### *Expected outcome:* | ||
|
||
'read book' will be added to the task list as a todo and currently be marked as not done | ||
|
||
``` | ||
____________________________________________________________ | ||
Got it. I've added this task: | ||
todo read book | ||
Now you have 1 tasks in the list. | ||
____________________________________________________________ | ||
``` | ||
|
||
|
||
## `deadline` - Adds a deadline to the collection of tasks | ||
|
||
#### *General format of command* | ||
deadline DESCRIPTION_OF_TASK /by DEADLINE_OF_TASK | ||
#### *Example of usage:* | ||
|
||
`deadline return book /by Tuesday` | ||
|
||
#### *Expected outcome:* | ||
|
||
'return book' will be added to the task list as a dealine and currently be marked as not done. The deadline of the event will be stored as 'Tuesday' | ||
|
||
``` | ||
____________________________________________________________ | ||
Got it. I've added this task: | ||
deadline return book /by Tuesday | ||
Now you have 2 tasks in the list. | ||
____________________________________________________________ | ||
``` | ||
|
||
|
||
## `event` - Adds an event to the collection of tasks | ||
|
||
#### *General format of command* | ||
event DESCRIPTION_OF_TASK /at TIME_OF_TASK | ||
#### *Example of usage:* | ||
|
||
`event go to party /at 6PM` | ||
|
||
#### *Expected outcome:* | ||
|
||
'go to party' will be added to the task list as an event and currently be marked as not done. The time of the event will be stored as '6PM' | ||
|
||
``` | ||
____________________________________________________________ | ||
Got it. I've added this task: | ||
event go to party /at 6PM | ||
Now you have 3 tasks in the list. | ||
____________________________________________________________ | ||
``` | ||
|
||
## `delete` - Deletes a task from the collection of tasks | ||
|
||
#### *General format of command* | ||
delete POSITION_TO_DELETE | ||
#### *Example of usage:* | ||
|
||
`delete 2` | ||
|
||
#### *Expected outcome:* | ||
|
||
Currently, the second task in the list is the deadline to 'return book' so this task will be deleted. | ||
|
||
``` | ||
expected output | ||
____________________________________________________________ | ||
Noted. I've removed this task: | ||
[D][ ] return book (by: Tuesday) | ||
Now you have 2 tasks in the list. | ||
____________________________________________________________ | ||
``` | ||
|
||
## `list` - Lists all tasks in the collection | ||
|
||
#### *General format of command* | ||
list | ||
#### *Example of usage:* | ||
|
||
`list` | ||
|
||
#### *Expected outcome:* | ||
|
||
Currently, the collection has 2 tasks: 'todo read book' and 'event go to party /at 6PM' so these two tasks will be listed. | ||
|
||
``` | ||
____________________________________________________________ | ||
[T][ ] read book | ||
[E][ ] go to party (at: 6PM) | ||
____________________________________________________________ | ||
``` | ||
|
||
## `mark` - marks a task in the collection as done | ||
|
||
#### *General format of command* | ||
mark POSITION_TO_MARK | ||
#### *Example of usage:* | ||
|
||
`mark 2` | ||
|
||
#### *Expected outcome:* | ||
|
||
The second task is currently 'go to party /at 6PM'. This will be marked as done. | ||
|
||
``` | ||
____________________________________________________________ | ||
Nice! I've marked this task as done: | ||
[E][X] go to party (at: 6PM) | ||
____________________________________________________________ | ||
``` | ||
|
||
## `unmark` - marks a task in the collection as not done | ||
|
||
#### *General format of command* | ||
unmark POSITION_TO_UNMARK | ||
#### *Example of usage:* | ||
|
||
`unmark 2` | ||
|
||
#### *Expected outcome:* | ||
|
||
The second task is currently 'go to party /at 6PM'. This will be marked as not done. | ||
|
||
``` | ||
____________________________________________________________ | ||
OK, I've marked this task as not done yet: | ||
[E][ ] go to party (at: 6PM) | ||
____________________________________________________________ | ||
``` | ||
|
||
|
||
## `find` - finds all tasks in the collection which contain the word entered by user | ||
|
||
#### *General format of command* | ||
find WORD_TO_FIND | ||
#### *Example of usage:* | ||
|
||
`find book` | ||
|
||
#### *Expected outcome:* | ||
|
||
The first task is the only task which contains the word 'book' so that will be displayed. | ||
|
||
``` | ||
____________________________________________________________ | ||
[T][ ] read book | ||
____________________________________________________________ | ||
``` | ||
|
||
## `bye` - closes the application | ||
|
||
#### *General format of command* | ||
bye | ||
#### *Example of usage:* | ||
|
||
`bye` | ||
|
||
#### *Expected outcome:* | ||
The application closes | ||
|
||
``` | ||
____________________________________________________________ | ||
Bye. Hope to see you again soon! | ||
____________________________________________________________ | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Deadline class | ||
* extends the Task class to store a particular type of task (deadline) | ||
* contains a description of the task (String description) | ||
* contains a deadline (String by) | ||
*/ | ||
public class Deadline extends Task{ | ||
|
||
protected String by; | ||
|
||
public Deadline(String description, String by) { | ||
super(description); | ||
this.by = by; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[D]" + super.toString() + " (by: " + by + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,110 @@ | ||
/** | ||
* Main Duke class | ||
* runs the main operations of the Application | ||
*/ | ||
|
||
import java.util.ArrayList; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Scanner; | ||
import java.io.FileWriter; | ||
|
||
|
||
public class Duke { | ||
public static void main(String[] args) { | ||
String logo = " ____ _ \n" | ||
+ "| _ \\ _ _| | _____ \n" | ||
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
static String inputText = ""; | ||
static ArrayList<Task> tasks = new ArrayList<>(); | ||
static ArrayList<String> storedTasks = new ArrayList<>(); | ||
static int taskCount = 0; | ||
static boolean isRunning = true; | ||
|
||
public static void main(String[] args) throws NullCommandException, IOException { | ||
File f = new File("data.txt"); | ||
if(f.exists()) { | ||
Scanner s = new Scanner(f); | ||
while(s.hasNext()) { | ||
storedTasks.add(s.nextLine()); | ||
} | ||
handleStoredTasks(); | ||
} | ||
FileWriter fw = new FileWriter("data.txt"); | ||
UI.welcomeMessage(); | ||
handleUserInput(); | ||
for (Task task : tasks) { | ||
fw.write(task.toString() + "\n"); | ||
} | ||
fw.close(); | ||
} | ||
|
||
public static void handleStoredTasks(){ | ||
TaskList.handleStoredTasks(storedTasks,tasks); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary empty line here |
||
public static void handleListMessage(){ | ||
UI.listMessage(tasks); | ||
} | ||
|
||
/** | ||
* Adds new task to collection based on command type. | ||
* @param command which specifies whether it is todo, deadline, or an event | ||
*/ | ||
public static void addNewTask(String command) { | ||
TaskList.addTask(command, tasks, inputText); | ||
} | ||
|
||
/** | ||
* Deletes task from the collection at the position specified by user | ||
* @param position specifies which task number to delete | ||
*/ | ||
public static void handleDeleteCommand(int position) { | ||
TaskList.deleteTask(position,tasks); | ||
} | ||
|
||
/** | ||
* handles any command from user to mark or unmark a task | ||
* @param position specifies which task in the collection to mark | ||
*/ | ||
public static void handleMarkMessage(int position){ | ||
|
||
if ((inputText.substring(0,4).equals("mark"))){ | ||
TaskList.markTask(position, tasks); | ||
}else{ | ||
TaskList.unmarkTask(position, tasks); | ||
} | ||
} | ||
|
||
/** | ||
* handles a command from user to search for all tasks with a specific word | ||
* @param word specifies which word to search for in collection | ||
*/ | ||
public static void handleFindMessage(String word){ | ||
TaskList.findTask(tasks,word); | ||
} | ||
|
||
/** | ||
* Runs the program, takes input from user and carries out all operations till the user enters bye | ||
* when user enters bye, program is closed | ||
* based on the type of command entered by the user, different functions are called. | ||
*/ | ||
public static void handleUserInput() { | ||
while(isRunning){ | ||
inputText = UI.getInput(); | ||
String command = Parser.parseCommand(inputText); | ||
if(command.equals("bye")) { | ||
isRunning = false; | ||
UI.exitMessage(); | ||
} else if (command.equals("list")) { | ||
handleListMessage(); | ||
}else if ((command.equals("mark")) || command.equals("unmark") ) { | ||
int position = Parser.getPositionFromInput(inputText); | ||
handleMarkMessage(position); | ||
}else if(command.equals("delete")){ | ||
handleDeleteCommand(Parser.getDeletePosition(inputText)); | ||
} else if (command.equals("find")) { | ||
String word = Parser.parseFindCommand(inputText); | ||
handleFindMessage(word); | ||
} else{ | ||
addNewTask(Parser.getTaskType(inputText)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Event class | ||
* extends the Task class to store a particular type of task (event) | ||
* contains a description of the task (String description) | ||
* contains a time when the event will take place (String at) | ||
*/ | ||
public class Event extends Task{ | ||
protected String at; | ||
|
||
public Event(String description, String at) { | ||
super(description); | ||
this.at = at; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return "[E]" + super.toString() + " (at: " + at + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public class InvalidCommandException extends Exception{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: Duke | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public class NullCommandException extends Exception { | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply with coding standards, perhaps you can consider adding space between
Task
and{
.