Skip to content

Commit

Permalink
Remove unused code, variables, and update javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
PyromancerBoom committed Feb 29, 2024
1 parent 57a5c3b commit 7e4f3b3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/main/java/duke/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ private LocalDateTime parseDueDate(String dueDate) throws BotException {
try {
return LocalDateTime.parse(dueDate, formatter);
} catch (DateTimeParseException ignored) {
continue;
}
}
throw new BotException("Invalid date format."
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private String handleDeleteCommand(String[] userInputArray) throws BotException
/**
* Handles the marking of a task as done
*
* @param inputs The user inputs
* @param userInputArray The user inputs
* @throws BotException If the task number is missing, not numeric, or out of
* range
*/
Expand Down Expand Up @@ -241,7 +241,7 @@ private String handleMarkTask(String[] userInputArray) throws BotException {
/**
* Handles the command to unmark a task
*
* @param inputs The array of inputs containing the task number to unmark
* @param userInputArray The array of inputs containing the task number to unmark
* @throws BotException If the task number is not provided, is not numeric, or
* is out of range
*/
Expand Down Expand Up @@ -270,7 +270,7 @@ private String handleUnmarkTask(String[] userInputArray) throws BotException {
/**
* Handles the "todo" command by adding a new todo task to the task list
*
* @param userInputArr the array containing the user input
* @param userInputArray the array containing the user input
* @throws BotException if the description of the todo is empty
*/
private String handleTodoCommand(String[] userInputArray) throws BotException {
Expand All @@ -288,7 +288,7 @@ private String handleTodoCommand(String[] userInputArray) throws BotException {
/**
* Handles the "deadline" command by adding a deadline task to the task list
*
* @param userInputArr the array containing the user input
* @param userInputArray the array containing the user input
* @throws BotException if the user input is incomplete
*/
private String handleDeadlineCommand(String[] userInputArray) throws BotException {
Expand All @@ -314,7 +314,7 @@ private String handleDeadlineCommand(String[] userInputArray) throws BotExceptio
* Adds the event task to the task list with the specified start time and end
* time
*
* @param userInputArr the user input array containing the event command and its
* @param userInputArray the user input array containing the event command and its
* arguments
* @throws BotException if the description and time of an event are empty
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/java/duke/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void start(Stage stage) {
Scene scene = new Scene(ap);
stage.setScene(scene);
fxmlLoader.<MainWindow>getController().setDuke(duke);
stage.setTitle("WannaBeSkynet");
stage.show();
} catch (IOException e) {
e.printStackTrace();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private void handleDeleteCommand(String[] userInputArray) throws BotException {
/**
* Handles the "todo" command by adding a new todo task to the task list
*
* @param userInputArr the array containing the user input
* @param userInputArray the array containing the user input
* @throws BotException if the description of the todo is empty
*/
private void handleTodoCommand(String[] userInputArray) throws BotException {
Expand All @@ -198,7 +198,7 @@ private void handleTodoCommand(String[] userInputArray) throws BotException {
/**
* Handles the "deadline" command by adding a deadline task to the task list
*
* @param userInputArr the array containing the user input
* @param userInputArray the array containing the user input
* @throws BotException if the user input is incomplete
*/
private void handleDeadlineCommand(String[] userInputArray) throws BotException {
Expand All @@ -219,7 +219,7 @@ private void handleDeadlineCommand(String[] userInputArray) throws BotException
* Adds the event task to the task list with the specified start time and end
* time
*
* @param userInputArr the user input array containing the event command and its
* @param userInputArray the user input array containing the event command and its
* arguments
* @throws BotException if the description and time of an event are empty
*/
Expand Down Expand Up @@ -252,7 +252,7 @@ private void addTaskMsg() {
/**
* Handles the marking of a task as done
*
* @param inputs The user inputs
* @param userInputArray The user inputs
* @throws BotException If the task number is missing, not numeric, or out of
* range
*/
Expand Down Expand Up @@ -280,7 +280,7 @@ private void markTaskHandler(String[] userInputArray) throws BotException {
/**
* Handles the command to unmark a task
*
* @param inputs The array of inputs containing the task number to unmark
* @param userInputArray The array of inputs containing the task number to unmark
* @throws BotException If the task number is not provided, is not numeric, or
* is out of range
*/
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/duke/TaskRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void processTask(String[] taskDetails, Boolean isTaskDone, String taskTy
throws BotException {
switch (taskType) {
case "T":
processTodoTask(taskDetails, isTaskDone, description);
processTodoTask(isTaskDone, description);
break;
case "D":
processDeadlineTask(taskDetails, isTaskDone, description);
Expand All @@ -95,12 +95,10 @@ private void processTask(String[] taskDetails, Boolean isTaskDone, String taskTy
/**
* Processes a Todo task's details and adds it to the TaskList.
*
* @param taskDetails The details of the task.
* @param isTaskDone Whether the task is done.
* @param description The description of the task.
* @throws BotException If there is an error while processing the task.
*/
private void processTodoTask(String[] taskDetails, Boolean isTaskDone, String description) throws BotException {
private void processTodoTask(Boolean isTaskDone, String description) {
taskList.addTodo(description);
if (isTaskDone) {
taskList.getTaskByNum(taskList.getTaskCount()).markAsDone();
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/duke/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ public static String wrapWithSepLine(String input) {
return SEPARATOR_LINE + "\n" + input + "\n" + SEPARATOR_LINE;
}

/**
* Wraps a list of strings with separator lines and returns the result
* Each string in the list is placed on a new line
*
* @param list The list of strings to be wrapped
* @return The list of strings wrapped with separator lines
*/
public static String wrapWithSepLine(List<String> list) {
StringBuilder sb = new StringBuilder(SEPARATOR_LINE);
System.out.println();
for (String item : list) {
sb.append("\n").append(item);
}
sb.append("\n").append(SEPARATOR_LINE);
return sb.toString();
}

/**
* Prints a list of strings to the terminal
* Each string in the list is placed on a new line
Expand Down

0 comments on commit 7e4f3b3

Please sign in to comment.