Skip to content

Commit

Permalink
Merge branch 'branch-Level-10'
Browse files Browse the repository at this point in the history
  • Loading branch information
QianChangru committed Sep 10, 2023
2 parents 9ff4bbc + 76ab079 commit d1c94f8
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 20 deletions.
3 changes: 3 additions & 0 deletions src/main/java/duke/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public Deadline(String description, boolean isDone, LocalDate by) {
this.by = by;
}

/**
* Returns a String representation for the task for output.
*/
@Override
public String toString() {
return "[D]" + super.toString() + " (by: "
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/duke/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import javafx.scene.layout.HBox;

/**
* An example of a custom control using FXML.
* This control represents a dialog box consisting of an ImageView to represent the speaker's face and a label
* containing text from the speaker.
*/
Expand Down Expand Up @@ -49,10 +48,21 @@ private void flip() {
setAlignment(Pos.TOP_LEFT);
}

/**
* Returns user dialog.
*
* @param text The text of the user.
* @param img The image of the user.
*/
public static DialogBox getUserDialog(String text, Image img) {
return new DialogBox(text, img);
}

/**
* Returns chat bot dialog.
*
* @param text The text of the chat bot.
* @param img The image of the chat bot.
*/
public static DialogBox getDukeDialog(String text, Image img) {
var db = new DialogBox(text, img);
db.flip();
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package duke;

import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.layout.VBox;

import java.io.IOException;
import java.util.Scanner;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/duke/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public Event(String description, boolean isDone, LocalDate startTime, LocalDate
this.endTime = endTime;
}

/**
* Returns a String representation for the task for output.
*/
@Override
public String toString() {
return "[E]" + super.toString() + " (from: "
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/duke/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public void setDuke(Duke d) {
}

/**
* Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
* Creates two dialog boxes, one echoing user input and the other
* containing Duke's reply and then appends them to
* the dialog container. Clears the user input after processing.
*/
@FXML
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public Parser(String command, Storage storage, TaskList taskList) {

/**
* Parses the user input and initiate following operations.
*
* @return The resulting message.
*/
public String parse() {
try{
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/duke/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import java.io.FileWriter;
import java.io.IOException;

import java.util.Locale;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import java.util.ArrayList;
import java.util.Locale;
import java.util.Scanner;

/**
Expand All @@ -22,7 +22,8 @@ public Storage(String filePath) {
}

/**
* Loads the task list with file.
* Loads the task list with file. Initializes the file
* when necessary.
*
* @return The task list.
* @throws IOException If unable to gain input from file.
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/duke/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public void markAsDone() {
this.isDone = true;
}

/**
* Returns a String representation for the task for output.
*/
@Override
public String toString() {
return "[" + this.getStatusIcon() + "] " + this.description;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/duke/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public TaskList(ArrayList<Task> tasks, Storage storage) {

/**
* Lists all tasks in the task list.
*
* @return The message for listing.
*/
public String listTasks() {
return Ui.listTasks(this.tasks);
Expand All @@ -30,6 +32,7 @@ public String listTasks() {
* Adds one task to the task list.
*
* @param t The task to be added.
* @return The message for adding.
*/
public String addTask(Task t) {
this.tasks.add(t);
Expand All @@ -41,6 +44,7 @@ public String addTask(Task t) {
* Deletes the task at the specified position in the task list.
*
* @param num The position starts from 0.
* @return The message for deleting.
*/
public String deleteTask(int num) {
Task re = tasks.remove(num);
Expand All @@ -52,6 +56,7 @@ public String deleteTask(int num) {
* Marks the task at the specified position in the task list.
*
* @param num The position starts from 0.
* @return The message for marking.
*/
public String markTask(int num) {
Task t = tasks.get(num);
Expand All @@ -64,6 +69,7 @@ public String markTask(int num) {
* Searches all Tasks with the keyword.
*
* @param keyword The keyword.
* @return The message for searching results.
*/
public String findTask(String keyword) {
ArrayList<Task> result = new ArrayList<>();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/duke/ToDo.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public ToDo(String description, boolean isDone) {
super(description, isDone);
}

/**
* Returns a String representation for the task for output.
*/
@Override
public String toString() {
return "[T]" + super.toString();
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/duke/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
public class Ui {

/**
* Prints welcome message.
* Returns welcome message.
*/
public static String welcomeMessage() {
return " Hello! I'm Jarvis\n"
+ " What can I do for you?";
}

/**
* Prints all tasks in task list.
* Returns all tasks in task list.
*
* @param tasks The task list.
*/
Expand All @@ -32,7 +32,7 @@ public static String listTasks(ArrayList<Task> tasks) {
}

/**
* Prints matching tasks in task list.
* Returns matching tasks in task list.
*
* @param tasks The task list.
*/
Expand All @@ -48,7 +48,7 @@ public static String listMatchingTasks(ArrayList<Task> tasks) {
}

/**
* Prints message for marking a task.
* Returns message for marking a task.
*
* @param t The task marked.
*/
Expand All @@ -58,7 +58,7 @@ public static String markTask(Task t) {
}

/**
* Prints the message for adding a task.
* Returns the message for adding a task.
*
* @param t The task added.
* @param taskList The task list of the task.
Expand All @@ -70,7 +70,7 @@ public static String addTask(Task t, ArrayList<Task> taskList) {
}

/**
* Prints the message for deleting a task.
* Returns the message for deleting a task.
*
* @param t The task deleted.
* @param taskList The task list of the task.
Expand All @@ -82,7 +82,7 @@ public static String deleteTask(Task t, ArrayList<Task> taskList) {
}

/**
* Prints the exception message.
* Returns the exception message.
*
* @param e The exception printed.
*/
Expand All @@ -91,7 +91,7 @@ public static String printException(DukeException e) {
}

/**
* Prints farewell message.
* Returns farewell message.
*/
public static String farewellMessage() {
return " Bye. Hope to see you again soon!";
Expand Down

0 comments on commit d1c94f8

Please sign in to comment.