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

[LWachtel1] iP #201

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
faef04a
Rename Duke to CHAT-MAN; define greet() and exit() methods
LWachtel1 Feb 2, 2024
17119f6
Create getUserCommands() & echoUsercommand() to echo input
LWachtel1 Feb 9, 2024
c1b6527
Store and list text; change echoUserCommand() to executesCommand()
LWachtel1 Feb 9, 2024
5bcc60f
Create Task class; defined getter & setter methods, including for isDone
LWachtel1 Feb 10, 2024
590b742
Add marking of task completion status in executesCommand()
LWachtel1 Feb 10, 2024
d2836b6
Change code to comply with Google Java Style guide; use switch statement
LWachtel1 Feb 11, 2024
9ecc201
Add support for task types Todo, Deadline & Event (inherit from Task)
LWachtel1 Feb 20, 2024
e0533a4
Check code quality: nesting, method length & use, expression complexity
LWachtel1 Feb 21, 2024
2d5fbe7
Provide commands for semi-automated chatbot testing
LWachtel1 Feb 27, 2024
8ad5b60
Update all classes to follow SE-EDU Java coding standard
LWachtel1 Feb 27, 2024
b46bf23
Add packages, Javadoc comments, exception handlers & additional classes
LWachtel1 Mar 18, 2024
11dac79
Remove methods made redundant after extract class refactoring
LWachtel1 Mar 18, 2024
596429c
Remove redundant exception classes
LWachtel1 Mar 20, 2024
7faa122
Fix TaskCommand subclass & MarkUnmarkCommand guard clauses
LWachtel1 Mar 20, 2024
ceee147
Add EmptyListException class & corresponding exception handling
LWachtel1 Mar 20, 2024
8a7951e
Make task ArrayList reference private & add public static access method
LWachtel1 Mar 20, 2024
adb18d3
Add IncorrectFormatException class & corresponding exception handling
LWachtel1 Mar 20, 2024
6d7b4e8
Update exception classes with command-specific error messages
LWachtel1 Mar 20, 2024
94e2207
Remove coding standard whitespace violations
LWachtel1 Mar 20, 2024
517dc97
Merge branch 'branch-Level-5'
LWachtel1 Mar 20, 2024
660c790
Implement support for deleting tasks from stored task list
LWachtel1 Mar 22, 2024
72c651b
Replace IncorrectMarkUnmarkException with IncorrectIndexException
LWachtel1 Mar 22, 2024
78a23fe
Add storage package & StorageHandler class, add method to open file
LWachtel1 Mar 22, 2024
74367d4
Implement functionality for saving task list to hard disk
LWachtel1 Mar 22, 2024
3ce5e14
Fix coding standard violations
LWachtel1 Mar 22, 2024
aaa70e4
Merge branch 'branch-level-6': add task deletion
LWachtel1 Mar 22, 2024
252102b
Merge branch 'branch-level-7': add functionality to save tasks to disk
LWachtel1 Mar 22, 2024
e037d6f
Add additional classes to enhance OOP
LWachtel1 Mar 22, 2024
f091848
Merge branch 'branch-A-MoreOOP': Add additional OOP
LWachtel1 Mar 22, 2024
592dd4c
Add FindCommand class to implement search list by keyword functionality
LWachtel1 Mar 22, 2024
d0788dc
Add additional Javadocs & comment out unneeded statements
LWachtel1 Mar 22, 2024
ba477a5
Merge pull request #1 from LWachtel1/branch-Level-9
LWachtel1 Mar 22, 2024
7528a49
Check Javadocs, remove redundant comments, update switch statements
LWachtel1 Mar 22, 2024
710bc99
Merge pull request #2 from LWachtel1/branch-A-JavaDoc
LWachtel1 Mar 22, 2024
ca539a1
Add User Guide
LWachtel1 Mar 22, 2024
c02b218
Update User Guide to meet requirements
LWachtel1 Mar 22, 2024
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
@@ -1,4 +1,4 @@
# Duke project template
# chatman 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.

Expand All @@ -13,7 +13,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
3. After that, locate the `src/main/java/chatman.java` file, right-click it, and choose `Run chatman.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
```
Hello from
____ _
Expand Down
Empty file added chatman.txt
Empty file.
167 changes: 154 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,170 @@
# User Guide
# ChatMan User Guide

**ChatMan** is a chatbot that enables storage and tracking of a user's different tasks.

It possesses 3 main categories of tasks:

- **todos** (tasks without any timeframe)
- **deadlines** (tasks with endpoints for completion)
- **events** (tasks with start-point and endpoints)

A user can interact with **ChatMan** using commands that allow them to add & remove tasks from storage, mark them as
complete/incomplete, list all currently stored tasks and find stored tasks using keyword search.

## Features

### Feature-ABC
This section details all **ChatMan** commands available to a user, what they do and how to correctly format them.

### Listing stored tasks: `list`

Displays all currently stored tasks to user.

Format: `list`

*Example output:*
```
1.[T][ ]return book
2.[D][ ]buy gifts (by: 24th December)
3.[E][ ]job interview (from: 25th March 10am to: 11am)
```
### Searching stored tasks: `find`

Returns all tasks whose descriptions contain the keyword/key-phrase provided with 'find'.

Format: `find KEYWORD`

>Please note that `KEYWORD` cannot contain any **/** characters

Description of the feature.
*Example input:*
`find job`

### Feature-XYZ
*Example output:*
```
Here are the full matches in your list for 'job':
3.[E][ ]job interview (from: 25th March 10am to: 11am)
```
### Adding a todo: `todo`
Adds a task without any timeframe to the task list. By default, this task is not marked as complete.

Description of the feature.
Format: `todo DESCRIPTION`

## Usage
>Please note that `DESCRIPTION` cannot contain any **/** characters

### `Keyword` - Describe action
*Example input:*
`todo return book`

Describe the action and its outcome.
*Example output:*
```
Got it. I've added this task:
[T][ ]return book
Now you have 1 tasks in the list.
```

Example of usage:
### Adding a deadline: `deadline`
Adds a task with an endpoint to the task list. By default, this task is not marked as complete.

`keyword (optional arguments)`
Format: `deadline DESCRIPTION /by ENDPOINT`

Expected outcome:
>Please note that all ARGUMENTS cannot contain any **/** characters

Description of the outcome.
*Example input:*
`deadline buy gifts /by 24th December`

*Example output:*
```
expected output
Got it. I've added this task:
[D][ ]buy gifts (by: 24th December)
Now you have 2 tasks in the list.
```

### Adding an event: `event`
Adds a task with a start-point and an endpoint to the task list. By default, this task is not marked as complete.

Format: `event DESCRIPTION /from STARTPOINT /to ENDPOINT`

>Please note that all ARGUMENTS cannot contain any **/** characters

*Example input:*
`event job interview /from 25th March 10am /to 11am`

*Example output:*
```
Got it. I've added this task:
[E][ ]job interview (from: 25th March 10am to: 11am)
Now you have 3 tasks in the list.
```
### Marking & unmarking tasks: `mark` and `unmark`

`mark` labels a stored task (at the provided list position) as complete.
`unmark` labels a stored task (at the provided list position) as incomplete.

*[X]* is the 'complete' label.

*[ ]* is the 'incomplete' label.

Format:
- `mark LIST_POSITION`
- `unmark LIST_POSITION`

>Please note that LIST_POSITION must be a numerical position within the bounds of the list.

*Example input:*
`mark 1`

*Example Output:*
```
Nice! I've marked this task as done:
[T][X]return book
```
The action of this command is also reflected when the user next enters `list`:
```
1.[T][X]return book
2.[D][ ]buy gifts (by: 24th December)
3.[E][ ]job interview (from: 25th March 10am to: 11am)
```

### Deleting tasks: `delete`

Removes the stored task, at the provided list position, from the task list.

Format: `delete LIST_POSITION`

>Please note that LIST_POSITION must be a numerical position within the bounds of the list.

*Example input:*
`delete 1`

*Example Output:*
```
Noted. I've removed this task:
[T][X]return book
Now you have 2 tasks in the list.
```
The action of this command is also reflected when the user next enters `list`:
```
1.[D][ ]buy gifts (by: 24th December)
2.[E][ ]job interview (from: 25th March 10am to: 11am)
```

### Exiting ChatMan: `bye`

Terminates **ChatMan** execution.

Format: `bye`

*Output:*
`Bye. Hope to see you again soon!`

## Command Summary

| Action | Command Format |
|---------------------------|---------------------------------------------------|
| list tasks | `list` |
| keyword/key-phrase search | `find KEYWORD` |
| add a todo | `todo DESCRIPTION` |
| add a deadline | `deadline DESCRIPTION /by ENDPOINT` |
| add an event | `event DESCRIPTION /from STARTPOINT /to ENDPOINT` |
| mark a task as complete | `mark LIST_POSITION` |
| mark a task as incomplete | `unmark LIST_POSITION` |
| delete a task | `delete LIST_POSITION` |
| exit | `bye` |
6 changes: 6 additions & 0 deletions src/main/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/main/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions src/main/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

This file was deleted.

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

import chatman.commands.GreetCommand;
import chatman.exceptions.*;
import chatman.storage.StorageHandler;
import chatman.utility.Tasklist;
import chatman.utility.Ui;


import java.io.IOException;

/**
* Provides entry point for ChatMan.
*
* @author LWachtel1
* */
public class ChatMan {

private Ui chatbot;

public ChatMan() {
chatbot = new Ui();
}

/**
* Opens task storage file and loads file contents into list of stored tasks upon initial program execution.
* If successful, prints greeting for user and calls chatbot.read() to trigger ChatMan loop execution.
* Also provides handlers for any exceptions.
**/
public void run() {

try {
StorageHandler.openStorageFile();
StorageHandler.loadStorageFile();

GreetCommand hello = new GreetCommand(" ");
hello.perform();


chatbot.read();

} catch(IOException e) {
System.out.println(e.getMessage());
} catch (FalseCommandException e) {
e.sendErrorMsg();
} catch (FullListException e) {
e.sendErrorMsg();
} catch (IncorrectArgumentNumException e) {
e.sendErrorMsg();
} catch (IncorrectIndexException e) {
e.sendErrorMsg();
} catch (EmptyListException e) {
e.sendErrorMsg();
} catch (IncorrectFormatException e) {
e.sendErrorMsg();
}

}

/**
* Main method of program.
**/
public static void main(String[] args) {
new ChatMan().run();
}
}
39 changes: 39 additions & 0 deletions src/main/java/chatman/commands/ByeCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package chatman.commands;

import chatman.exceptions.IncorrectArgumentNumException;

/**
* Implements functionality to enable ChatMan response to user-entered "bye" command.
*
* @author LWachtel1
* */
public class ByeCommand extends Command{

/**
* Constructor for ByeCommand; invokes superclass constructor.
*
* @param userCommand Receives and stores user-entered command (from Parser object) to use in perform()
* method.
* */
public ByeCommand(String userCommand) {
super(userCommand);
}

/**
* Prints goodbye message for ChatMan user; called if they enter "bye" command with no arguments.
*
* @throws IncorrectArgumentNumException If "bye" command entered with any additional arguments.
*/
@Override
public void perform() throws IncorrectArgumentNumException {
String[] fullCommand= userCommand.split(" ");
if (fullCommand.length > 1) {
String erroneousInput= userCommand.replaceAll("(?i)BYE", "");
throw new IncorrectArgumentNumException("BYE", erroneousInput);
}

System.out.printf("%s%n", "____________________________________________________________");
System.out.printf("%s%n", "Bye. Hope to see you again soon!");
System.out.printf("%s%n", "____________________________________________________________");
}
}
Loading