forked from nus-cs2103-AY2324S2/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
549 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
package homie; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** | ||
* Deadline class that extends the Task class. | ||
* Can specify the Local Date Time to keep track of | ||
* when to complete deadline by. | ||
* The Deadline class that extends the Task class. Handles all deadline related tasks. | ||
* Can specify the Local Date Time to keep track of when to complete deadline by. | ||
*/ | ||
public class Deadline extends Task { | ||
public class Deadline extends Task implements Serializable { | ||
|
||
protected LocalDateTime by; | ||
protected LocalDateTime dueDateTime; | ||
|
||
/** | ||
* Constructor for Deadline class | ||
* @param description For the deadline task | ||
* @param by This is the Local Date Time to complete the deadline by | ||
* Constructor for Deadline class to create a new deadline instance. | ||
* | ||
* @param description The description of deadline task. | ||
* @param by This is the Local Date Time to complete the deadline by. | ||
*/ | ||
public Deadline(String description, String by) { | ||
super(description); | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MM yyyy HHmm"); | ||
this.by = LocalDateTime.parse(by, formatter); | ||
this.dueDateTime = LocalDateTime.parse(by, DateTimeFormatter.ofPattern("dd MM yyyy HHmm")); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[D][" + this.getStatusIcon() + "] " + super.toString() + " (by: " | ||
+ by.format(DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm")) + ")"; | ||
+ this.dueDateTime.format(DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm")) + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package homie; | ||
|
||
/** | ||
* Deadline exception class. Handles all exceptions related to Deadline class. | ||
* Thrown when no description for deadline task is given, or format of due date is wrong. | ||
*/ | ||
public class DeadlineException extends Exception { | ||
/** | ||
* Constructor for DeadlineException class. | ||
* | ||
* @param message The error message. | ||
*/ | ||
public DeadlineException(String message) { | ||
super("Bruh... " + message + "\nPlease follow the format:\ndeadline " | ||
+ "{DEADLINE_DESCRIPTION} /by {dd MM yyyy HHmm}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package homie; | ||
|
||
/** | ||
* Delete exception class. Handles all exceptions related to Delete command. | ||
* Thrown when no index is given, or index is out of range. | ||
*/ | ||
public class DeleteException extends Exception { | ||
/** | ||
* Constructor for DeleteException class. | ||
* | ||
* @param message The error message. | ||
*/ | ||
public DeleteException(String message) { | ||
super("Bruh... " + message + "\nPlease follow the format: \ndelete {INDEX}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
package homie; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** | ||
* Event class that extends Task class. | ||
* Can specify event starts from when and when the events end. | ||
* Event class that extends Task class. Handles all event related tasks. | ||
* Can specify event starting date time and ending date time. | ||
*/ | ||
public class Event extends Task { | ||
|
||
protected String from; | ||
protected String to; | ||
protected LocalDateTime startDateTime; | ||
protected LocalDateTime endDateTime; | ||
|
||
/** | ||
* Constructor for Event class | ||
* @param description For the Event Task. | ||
* @param from This is to keep track when the event starts | ||
* @param to This is to keep track when the event ends | ||
* | ||
* @param description The description of the event task. | ||
* @param start The start date time of event task in String, of 'dd MM yyyy HHmm' format | ||
* @param end The end date time of event task in String, of 'dd MM yyyy HHmm' format | ||
*/ | ||
public Event(String description, String from, String to) { | ||
public Event(String description, String start, String end) { | ||
super(description); | ||
this.from = from; | ||
this.to = to; | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MM yyyy HHmm"); | ||
this.startDateTime = LocalDateTime.parse(start, formatter); | ||
this.endDateTime = LocalDateTime.parse(end, formatter); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[E][" + this.getStatusIcon() + "] " + super.toString() + " (from: " + from + " to: " + to + ")"; | ||
return "[E][" + this.getStatusIcon() + "] " + super.toString() + " (from: " | ||
+ this.startDateTime.format(DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm")) + " to: " | ||
+ this.endDateTime.format(DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm")) + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package homie; | ||
|
||
/** | ||
* Event exception class. Handles all exceptions related to Event Class. | ||
* Thrown when no description of event is given, or start date or end date is of incorrect format. | ||
*/ | ||
public class EventException extends Exception { | ||
/** | ||
* Constructor for EventException class. | ||
* | ||
* @param message The error message. | ||
*/ | ||
public EventException(String message) { | ||
super("Bruh... " + message + "\nPlease follow the format:\n event {EVENT_DESCRIPTION} " | ||
+ "/from {dd MM yyyy HHmm} /to {dd MM yyyy HHmm}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package homie; | ||
|
||
/** | ||
* Find exception class. Handles all exceptions related to Find command. | ||
* Thrown when no keyword is given, or keyword is more than one word. | ||
*/ | ||
public class FindException extends Exception { | ||
/** | ||
* Constructor for MarkException class. | ||
* | ||
* @param message The error message. | ||
*/ | ||
public FindException(String message) { | ||
super("Bruh... " + message + "\nPlease follow the format:\nfind {KEYWORD}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package homie; | ||
|
||
/** | ||
* Homie Exception class | ||
* Homie Exception class. Handles all exceptions related to Homie class. | ||
* Thrown when invalid commands are given by user. | ||
*/ | ||
public class HomieException extends Exception { | ||
public HomieException(String message) { | ||
super(message); | ||
super("Bruh... Invalid command!\nPlease try again."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package homie; | ||
|
||
/** | ||
* Mark exception class. Handles all exceptions related to mark command. | ||
* Thrown when no index is given as a parameter, or index out of range. | ||
*/ | ||
public class MarkException extends Exception { | ||
/** | ||
* Constructor for MarkException class. | ||
* | ||
* @param message The error message. | ||
*/ | ||
public MarkException(String message) { | ||
super("Bruh... " + message + "\nPlease follow the format:\nmark {INDEX}"); | ||
} | ||
} |
Oops, something went wrong.