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

[Shui Jie] ip #493

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open

Conversation

sj1999-BIT
Copy link

@sj1999-BIT sj1999-BIT commented Aug 28, 2021

Ultimate Normal Scheduler

I am not more gifted than anybody else. I am just more curious than the average person and I will not give up a problem until I have found the proper solution.
-Albert Einstein

The Ultimate Normal Scheduler has one aim and one aim only, to make support you to be the ultimate Task Master!

  • text-based cause the GUI has not been done yet.
  1. download it from here.
  2. double click it.
  3. add your tasks, remove them, whatever you want!
  4. let it remember your tasks for you. That's all it's good for! 😉
  5. And it is FREE!

Features:

  • Managing tasks like a nagging mother
  • Managing deadlines (coming soon once the engineers stop throwing bananas)
  • Reminders (coming soon to computers near you)

Add this into the code to run it!
public class Main { public static void main(String[] args) { Application.launch(MainApp.class, args); } }

sj1999-BIT added 13 commits August 28, 2021 20:47
Added intro and bye
Added the ability to echo
Used an ArrayList to store list of items
Simplified overall structure. Added an ArrayList as global variable. changed the property of done.
Added  documentation to all the functions. Changed the choiceOfAction function such that it can recognize different task.

setDate function to create the date String
Changed the structure of the program such that the three task types are all subtask of the main Task
Created a test inputs and outputs
handle errors involving format problems for all three tasks. Exceptions is utilized.
Implement a deleteTask function to remove task when needed
This reverts commit af273dc.
Added 3 functions to save list into file, and then read them upon reopening.
Added in LocalDate and DateTimeFormatter.

Changed Deadline and Events Task restrictors as the format has now changed.
public class Duke {

private String line = "__________________________________\n";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this should be a final field?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that line is a constant. Maybe calling it LINE is more suitable for the coding standard.

* get isDone
* @return
*/
public boolean getIsDone() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should just be isDone()?

return output + " )";
}
/**
* modify the task message if done.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should try to capitalise all JavaDocs descriptions.

* @param input
* @return boolean
*/
private boolean choiceOfAction(String input) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a function that returns a boolean result, I do feel the naming should be isSetDone or isNewTask.

writer.write(formatTaskIntoCommands(task));
}
writer.close();
}catch (IOException io) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing error.

try {
Task newTask = createTask(input);
addTask(newTask);
} catch (TodoException tx) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that seperating exception for each class is quite unneccesary. Simply a TaskException would be easier to understand.

Copy link

@KelvinSoo KelvinSoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall not too many coding standard violations.
The code would look neater in packages.

public class Duke {

private String line = "__________________________________\n";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that line is a constant. Maybe calling it LINE is more suitable for the coding standard.

*/
private void greet() {
System.out.println(line);
String logo = " ____ _ \n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better for logo to be declared as a constant?

}
}
}catch (FileNotFoundException f) {
}catch(IOException io){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before the open curly bracket.

*/
public TodoTasks(String action) throws TodoException{
super(action, "[T][] ", TaskTypes.Todo);
if (action.split(" ").length < 2){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before the curly bracket.

sj1999-BIT added 6 commits August 31, 2021 21:37
Restructured the entire file to a more OOP structure. Java Doc is also updated.
Create 2 packages, Task and Storage. Subdivide classes into respective public class file.
forgot to add Duke package
Created two Junit Test to test the saving of file, and whether invalid inputs is not saved.
Created a workable Duke.java.jar file
Give users a way to find a task by searching for a keyword.

Restructured ChoiceOfAction. Now it only chooses which Action Function to use.

New function doneAction, deleteAction and findAction.
Copy link

@Wilfredwongkc Wilfredwongkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just some nit that is related to coding stnadards to fix


public class DukeTest {
@Test
public void dummyTest(){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void dummyTest(){
public void dummyTest() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can add a space?

@@ -0,0 +1,203 @@
package Storage;

import java.io.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can list out the things you want to import instead of using a wildcard?

import Task.EventsException;

public class Storage {
private final Parser parser= new Parser();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private final Parser parser= new Parser();
private final Parser PARSER = new Parser();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you are declaring a constant, it needs to be in caps. Also, don't forget the space before the "=".


// deals with making sense of the user command
class Parser {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove this empty line


@Test
public void testInvalidFormat() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove this empty line too

sj1999-BIT added 8 commits September 4, 2021 22:41
Changed many functions from TaskList and UI class such that they can return the message as String instead of printing it in the console. Setup the GUI which can print the results.
mistakes were made, this is the actual level 10
This reverts commit 8e28087.
1.Created a fat jar file underout\artifact\ip.jar.
@sj1999-BIT sj1999-BIT closed this Sep 10, 2021
@sj1999-BIT sj1999-BIT reopened this Sep 10, 2021
sj1999-BIT and others added 7 commits September 12, 2021 10:28
added new function isTaskDuplicate under parser.
The program can check if the input value will create a program that is already present in the tasklist
added new function isTaskDuplicate under parser.
The program can check if the input value will create a program that is already present in the tasklist
Improved code quality
1. changed multiple if-elseif statement to switch
2. Added new function comments
Remove a bug that causes program to print logo instead of parsing the input
Improved code quality
1. changed multiple if-elseif statement to switch
2. Added new function comments
Remove a bug that causes program to print logo instead of parsing the input
Copy link

@ramapriyan912001 ramapriyan912001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the work is excellent.
Some methods could be shortened perhaps.
Beyond that, great job!

Comment on lines +18 to +51
public void getDataInputList(TaskList lst) {
try {
File f = new File("src/main/java/Duke.txt");
if(!f.exists()){
f.createNewFile();
}
FileReader reader = new FileReader(f);
BufferedReader br = new BufferedReader(reader); //creates a buffering character input stream
String line;
Task curTask;

while ((line = br.readLine()) != null) {
boolean isCurTaskDone = false;
String[] data = line.split(" ");
int lengthLimit = data.length;
String taskData = "";

if (data[data.length - 1].equals("done")){
isCurTaskDone = true;
lengthLimit -= 1;
}
try {
for (int i = 0; i < lengthLimit; i++) {
taskData = taskData.concat(data[i] + " ");
}
curTask = parser.createTask(taskData);
if (isCurTaskDone) {
curTask.done();
}
lst.getTaskList().add(curTask);
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method exceeds 40 lines.
Method could be SLAP-ed harder.

Comment on lines +186 to +218
class TodoTasks extends Task{
/**
* constructor for Task.
*
* @param action contains all the information to build a TodoTask.
* @throws TodoException if the String action is invalid.
*/
public TodoTasks(String action) throws TodoException {
super(action, "[T][] ", TaskTypes.Todo);
if (action.split(" ").length < 2){
throw new TodoException("OOPS!!! The description of a todo cannot be empty.");
}
}
}

class DeadlineTask extends Task{
/**
* constructor for Task.
*
* @param action containinf all the data needed for the creation of Deadline Task.
* @throws DeadlineException if the String action is invalid.
*/
public DeadlineTask(String action) throws DeadlineException {
super(action, "[D][] ", TaskTypes.Deadline);
if (action.split("/").length < 2) {
throw new DeadlineException("incorrect format for deadline task");
}
if (action.split("/")[1].split(" ").length < 2) {
throw new DeadlineException("incorrect date format for Deadline task");
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should make these classes in separate java files rather than within another file.

sj1999-BIT and others added 16 commits September 13, 2021 19:02
Improved GUI by add different colors to Duke and User DialogBox.

Some error seemed to have occurred, reused previous local safed version to remove any errors.
Docs file was previously deleted by mistake
Amended user guide, partially done.

Debugged code such that the bug whereby check duplicate function fails to work is resolved.
smoke test done to test jar file validity
Improved syntax, removed the appearance of # in the UG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants