-
Notifications
You must be signed in to change notification settings - Fork 462
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
[Qi Ting] iP #492
base: master
Are you sure you want to change the base?
[Qi Ting] iP #492
Conversation
- Add basic greeting and exit phrases - Implement basic input reading
- Create ParseInput method to parse commands to the bot and call the relevant methods - Create AddToList and DisplayList methods to support text list feature > AddToList stores a given text string to a list > DisplayList prints all the text strings stored so far in order - Remove unused Echo method from Level-1
- Rework text list feature to a to-do list > Create Task class to represent tasks that can be added to the to-do list > Implement methods to support marking of Tasks as completed - Implement ParseArgs method to support chatbot commands with arguments
- Create Deadline, Event and ToDo classes that inherit from Task to support different types of Task creation - Refactor input parsing logic to support creation of different types of tasks
- Add test input to input.txt file - Performed testing using Runtest.bat - Fix bug where tasks could be created with empty name or date
- Create DukeException class to be thrown by and handled by methods in Duke - Refactor methods to use DukeException class in error handling
- Implement delete command > Tasks can now be deleted from the list by index - Modify test input to test deletion feature
- Chat history with Duke is now saved between runs and loaded on start
- Modify parsing of input to parse date arguments - Modify Deadline and Event class to store date as LocalDate instead of String
- Modify all code to follow coding style - Refactor task saving logic to be cleaner - Update javadocs
- Set up gradle
- Create Ui, TaskList, Storage, and Parser classes to handle different operations of Duke - Refactor code to these new classes
- Packaged all classes into one package Duke
- Added JUnit tests for adding tasks, loading and saving tasks, and parsing input commands
- Added JavaDocs to more methods
- Adjust code to follow coding standard where not done previously
- Add getter for taskName to Task class - Add search task by taskName functionality to TaskList class - Modify Parser class to accept search command - Add display text function for search command to Ui class
- Add checkstyle plugin to gradle - Use chcekstyle to find coding style violations - Resolve coding style violations
- Create GUI for Duke - User input is now received from the TextField component in MainWindow - handleUserInput function in MainWindow passes the user input to Duke - Duke takes the input and passes it to Parser - Duke now also stores the response to the user generated by Ui to be displayed by MainWindow
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.
LGTM! I like your error handling and OOP used! Also, your code follows the java coding standards very well. Good job!
src/main/java/duke/TaskList.java
Outdated
public static Task addEvent(String args) throws DukeException { | ||
String[] argsArr = args.split(" /at ", 2); | ||
if (argsArr.length < 2) { | ||
throw new DukeException("Failed to create event: Invalid number of arguments"); |
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.
I like how you handle many different types of errors. Good job on error handling!
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.
Thank you!
@@ -0,0 +1,231 @@ | |||
package duke; |
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.
Perhaps you can divide into multiple packages 😃
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.
Haha will take note
* A class used to represent a task. A task has a name and completion status. | ||
*/ | ||
public abstract class Task { | ||
protected static final String MARK_CHARACTER = "X"; |
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.
Good use of static constants!
/** | ||
* A class that handles the displaying of information to the user. | ||
*/ | ||
public class Ui { |
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.
I like the abstraction and OOP used here!
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.
LGTM! Very simple yet beautiful logic of code. Coding standard has been well adhered to. Good job!
break; | ||
default: | ||
throw new DukeException("Command not recognised"); | ||
} |
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.
I like how simple yet powerful you have made your parser.
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.
Thank you!
/** | ||
* Class used to represent a ToDo type task that has no date. | ||
*/ | ||
public class ToDo extends Task { |
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.
I like the use of inheritance for a more OOP approach.
* | ||
* @return A string that can be used to reconstruct the task. | ||
*/ | ||
public abstract String toSaveFormatString(); |
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.
I like the naming idea for this method.
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
private static final String BOT_NAME = "Duke"; |
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.
I like the use of a constant for this string that will be used often.
- Add Java asserts to handle some previously unhandled exceptions - TaskList: Use asserts to ensure null tasks cannot be added to the list - Duke: Use asserts to ensure Duke initializes correctly
* Refactor application launch process. - Move Launcher.main method to Duke.main. - Remove Launcher class since it is no longer used. * Add constant TASK_TYPE_CHARACTER to ToDo, Deadline and Event. This is to centralize the information of which character refers to which type of task e.g. T associated to ToDo. - Modify toString and toSaveFormatString methods in all subclasses of Task to make use of this constant. - Modify Storage class to check against this constant when attempting to load in tasks from file. * Move print statements to Duke's addToResponse method since all text to be displayed goes through that method.
Improve code quality
Branch a assertions
- Move gradle.yml file to .github\workflows folder
- Add sorting command to Parser - Add functionality to TaskList to sort by name - Update Ui to respond correctly to new command
Implement C-Sort
- Adjust argument format to be more flexible
- Update JUnit tests to account for changes to command format - Remove new line from TaskList::addEvent exception message for invalid arguments
- Change GUI color scheme to dark mode - Add help command to display available commands - Add command format info to user feedback when user inputs invalid command
Improve GUI and user friendliness
- Add usage information for all commands to user guide
Implement A-UserGuide
Duke prototype 0.2
Features
Command LineText-based with GUI interfaceSetting up:
If you're a Java programmer, you can use it to practice Java too. Here's the
main
method:Planned features