diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index cb6a15aca6..07142c7ccf 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,4 +1,14 @@ +/** + * Class to initiate the LEMONA task manager + */ public class Duke { + + /** + * The main method to start the Duke application. + * Creates an instance of Lemona task manager and runs it. + * + * @param args Command-line arguments (not used). + */ public static void main(String[] args) { Lemona lemona = new Lemona("data/lemona.txt"); lemona.run(); diff --git a/src/main/java/Lemona.java b/src/main/java/Lemona.java index e92205137f..2d935bc118 100644 --- a/src/main/java/Lemona.java +++ b/src/main/java/Lemona.java @@ -8,11 +8,21 @@ import task.Event; import task.Deadline; +/** + * The main class representing the Lemona task manager application. + * Lemona allows users to manage their tasks by adding, listing, marking, and deleting tasks. + * It also provides the functionality to save tasks to a file and load tasks from a file. + */ public class Lemona { private Storage storage; private TaskList tasks; private Ui ui; + /** + * Constructs a Lemona object with the specified file path for task storage. + * + * @param filePath The file path to store tasks. + */ public Lemona(String filePath) { ui = new Ui(); storage = new Storage(filePath); @@ -23,6 +33,13 @@ public Lemona(String filePath) { tasks = new TaskList(); } } + + /** + * Runs the Lemona application. + * Displays a welcome message and continuously waits for user input. + * Processes user commands and performs corresponding actions. + * Exits the application when the "bye" command is entered. + */ public void run() { ui.greet(); while (true) { diff --git a/src/main/java/Task/Deadline.java b/src/main/java/Task/Deadline.java index 5b738d9bd4..dfb26ecff1 100644 --- a/src/main/java/Task/Deadline.java +++ b/src/main/java/Task/Deadline.java @@ -7,12 +7,22 @@ import oop.Ui; +/** + * Represents a task with a deadline in the task manager application. + * A deadline task has a description and a due date. + */ public class Deadline extends Task{ private LocalDateTime dueDate; private static final String line = "\t______________________________________________________"; private DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm"); private DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("MMM dd yyyy HHmm", Locale.ENGLISH); + /** + * Constructs a Deadline task with the specified description and due date. + * + * @param description The description of the deadline task. + * @param dueDate The due date of the deadline task in the format "dd/MM/yyyy HHmm". + */ public Deadline(String description, String dueDate) { super(description); this.dueDate = LocalDateTime.parse(dueDate, inputFormat); diff --git a/src/main/java/Task/Event.java b/src/main/java/Task/Event.java index e27508f290..b32337916e 100644 --- a/src/main/java/Task/Event.java +++ b/src/main/java/Task/Event.java @@ -5,6 +5,10 @@ import java.time.format.DateTimeParseException; import java.util.Locale; +/** + * Represents an event task in the task manager application. + * An event task has a description, start time, and end time. + */ public class Event extends Task{ private LocalDateTime startTime; private LocalDateTime endTime; @@ -12,6 +16,13 @@ public class Event extends Task{ private DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm"); private DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("MMM dd yyyy HHmm", Locale.ENGLISH); + /** + * Constructs an Event task with the specified description, start time, and end time. + * + * @param description The description of the event task. + * @param startTime The start time of the event in the format "dd/MM/yyyy HHmm". + * @param endTime The end time of the event in the format "dd/MM/yyyy HHmm". + */ public Event(String description, String startTime, String endTime) { super(description); this.startTime = LocalDateTime.parse(startTime, inputFormat); diff --git a/src/main/java/Task/Task.java b/src/main/java/Task/Task.java index eb467f9ddd..9bbccb8af0 100644 --- a/src/main/java/Task/Task.java +++ b/src/main/java/Task/Task.java @@ -1,25 +1,43 @@ package task; +/** + * Represents a generic task in the task manager application. + * A task has a description and can be marked as done or undone. + */ public class Task { protected String description; protected boolean isDone; protected String type; + /** + * Constructs a Task with the specified description. + * + * @param description The description of the task. + */ public Task(String description) { this.description = description; this.isDone = false; } + /** + * Gets the status icon of the task. + * Returns "X" if the task is done, otherwise returns a space. + * + * @return The status icon of the task. + */ public String getStatusIcon() { return (isDone ? "X" : " "); // mark done task with X } + /** + * Gets the description of the task. + * + * @return The description of the task. + */ public String getDescription() { return this.description; } - public String getType() { - return ""; - } + public String getTaskInfo() { return this.description; }