Skip to content

Commit

Permalink
docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyuan123 committed Sep 30, 2021
1 parent 166e15a commit fab2cac
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ public Deadline(String description, String by) {
this.by = by;
}

public Deadline(String description, String by, String isDone) {
super(description);
this.by = by;
if (isDone.equals("1")) {
this.isDone = true;
}
}

@Override
public void printTask() {
System.out.println("[D]" + super.getStatusIcon() + super.getDescription() + "(by:" + by + ")");
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ public Event(String description, String at) {
this.at = at;
}

public Event(String description, String at, String isDone) {
super(description);
this.at = at;
if (isDone.equals("1")) {
this.isDone = true;
}
}

@Override
public void printTask() {
System.out.println("[E]" + super.getStatusIcon() + super.getDescription() + "(at: " + at + ")");
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ public static void loadDukeTextFile(File dukeTextFile, TaskList list) {
if (taskLetter.equals("T")) {
String[] dukeLineSplit = dukeTextLine.split("\\|", 3);
String todoDescription = dukeLineSplit[2];
Task task = new ToDo(todoDescription);
String todoIsDone = dukeLineSplit[1];
Task task = new ToDo(todoDescription, todoIsDone);
list.addTaskList(task);
} else if (taskLetter.equals("D")) {//Deadline
String[] dukeLineSplit = dukeTextLine.split("\\|", 4);
String deadlineDescription = dukeLineSplit[2].trim();
String deadlineIsDone = dukeLineSplit[1];
String deadlineBy = dukeLineSplit[3].trim();
Task task = new Deadline(deadlineDescription, deadlineBy);
Task task = new Deadline(deadlineDescription, deadlineBy, deadlineIsDone);
list.addTaskList(task);
} else {
String[] dukeLineSplit = dukeTextLine.split("\\|", 4);
String eventDescription = dukeLineSplit[2].trim();
String eventAt = dukeLineSplit[3].trim();
Task task = new Event(eventDescription, eventAt);
String eventIsDone = dukeLineSplit[1];
Task task = new Event(eventDescription, eventAt, eventIsDone);
list.addTaskList(task);
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/ToDo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ public ToDo(String description) {
super(description);
}

public ToDo(String description, String isDone) {
super(description);
if (isDone.equals("1")) {
this.isDone = true;
}
}

@Override
public void printTask() {
System.out.println("[T]" + super.getStatusIcon() + super.getDescription() );
System.out.println("[T]" + super.getStatusIcon() + super.getDescription());
}

@Override
public String getTextString() {
return("T" + "|" + super.getStatusValue() + "|" + super.getDescription() + "\n");
return ("T" + "|" + super.getStatusValue() + "|" + super.getDescription() + "\n");
}

}

0 comments on commit fab2cac

Please sign in to comment.