Skip to content

Commit

Permalink
Update import statement order
Browse files Browse the repository at this point in the history
Due to major refactoring in earlier commit, import statements
went out of order.

Update import statement order.
  • Loading branch information
jq1836 committed Sep 14, 2022
1 parent 3c0d53f commit 570f4d7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/main/java/rattus/chatbot/command/ListCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package rattus.chatbot.command;

import static rattus.chatbot.common.Message.MESSAGE_EMPTY_LIST;
import static rattus.chatbot.common.Message.MESSAGE_LIST;

import rattus.chatbot.data.task.TaskList;
import rattus.chatbot.common.Message;

/**
* A command that displays the list of tasks in the application. Displays an empty list message if the list is empty.
Expand All @@ -18,9 +20,9 @@ public class ListCommand extends Command {
protected String buildMessage() {
TaskList tasks = duke.getTasks();
if (tasks.isEmpty()) {
messageBuilder.buildLines(Message.MESSAGE_EMPTY_LIST);
messageBuilder.buildLines(MESSAGE_EMPTY_LIST);
} else {
messageBuilder.buildLines(Message.MESSAGE_LIST);
messageBuilder.buildLines(MESSAGE_LIST);
}
messageBuilder.buildLine(tasks.toString());
return messageBuilder.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package rattus.chatbot.command.addcommands;

import static rattus.chatbot.common.Message.MESSAGE_INVALID_ARGUMENT;

import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -8,7 +10,6 @@
import rattus.chatbot.data.task.Deadline;
import rattus.chatbot.data.task.Task;
import rattus.chatbot.util.Parser;
import rattus.chatbot.common.Message;

/**
* A command that adds an instance of {@link Deadline} to the list of tasks stored in the Duke application instance.
Expand Down Expand Up @@ -36,7 +37,7 @@ public AddDeadlineCommand(String arguments) {
protected Task supplyTask() throws InvalidInputException {
Matcher matcher = ADD_DEADLINE_ARGUMENT_FORMAT.matcher(arguments);
if (!matcher.matches()) {
throw new InvalidInputException(Message.MESSAGE_INVALID_ARGUMENT);
throw new InvalidInputException(MESSAGE_INVALID_ARGUMENT);
}
String description = matcher.group("description").strip();
LocalDateTime dateTime = Parser.parseDateTime(matcher.group("dateTime").strip());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package rattus.chatbot.command.addcommands;

import static rattus.chatbot.common.Message.MESSAGE_INVALID_ARGUMENT;

import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -8,7 +10,6 @@
import rattus.chatbot.data.task.Event;
import rattus.chatbot.data.task.Task;
import rattus.chatbot.util.Parser;
import rattus.chatbot.common.Message;

/**
* A command that adds an instance of {@link Event} to the list of tasks stored in the Duke application instance.
Expand Down Expand Up @@ -36,7 +37,7 @@ public AddEventCommand(String arguments) {
protected Task supplyTask() throws InvalidInputException {
Matcher matcher = ADD_EVENT_ARGUMENT_FORMAT.matcher(arguments);
if (!matcher.matches()) {
throw new InvalidInputException(Message.MESSAGE_INVALID_ARGUMENT);
throw new InvalidInputException(MESSAGE_INVALID_ARGUMENT);
}
String description = matcher.group("description").strip();
LocalDateTime dateTime = Parser.parseDateTime(matcher.group("dateTime").strip());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package rattus.chatbot.command.addcommands;

import static rattus.chatbot.common.Message.MESSAGE_ADDED_TASK;

import rattus.chatbot.command.Command;
import rattus.chatbot.command.CommandResult;
import rattus.chatbot.data.exception.InvalidInputException;
import rattus.chatbot.data.task.Task;
import rattus.chatbot.common.Message;

/**
* Encapsulates a {@link Command} that adds a task to the application's task list.
Expand All @@ -30,7 +31,7 @@ private void addTask() {

@Override
protected String buildMessage() {
messageBuilder.buildLines(Message.MESSAGE_ADDED_TASK, task.toString());
messageBuilder.buildLines(MESSAGE_ADDED_TASK, task.toString());
return messageBuilder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package rattus.chatbot.command.filtercommands;

import static rattus.chatbot.common.Message.MESSAGE_EMPTY_LIST;
import static rattus.chatbot.common.Message.MESSAGE_FILTERED_TASKS;

import java.util.function.Predicate;

import rattus.chatbot.command.Command;
import rattus.chatbot.command.CommandResult;
import rattus.chatbot.data.exception.InvalidInputException;
import rattus.chatbot.data.task.Task;
import rattus.chatbot.data.task.TaskList;
import rattus.chatbot.common.Message;

/**
* Encapsulates a command that filters the application's task list.
Expand All @@ -28,9 +30,9 @@ public abstract class FilterCommand extends Command {
@Override
protected String buildMessage() {
if (filteredTasks.isEmpty()) {
messageBuilder.buildLine(Message.MESSAGE_EMPTY_LIST);
messageBuilder.buildLine(MESSAGE_EMPTY_LIST);
} else {
messageBuilder.buildLine(Message.MESSAGE_FILTERED_TASKS);
messageBuilder.buildLine(MESSAGE_FILTERED_TASKS);
messageBuilder.buildLine(filteredTasks.toString());
}
return messageBuilder.toString();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/rattus/chatbot/storage/Storage.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package rattus.chatbot.storage;

import static rattus.chatbot.common.Message.MESSAGE_INVALID_FILE_NAME;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import rattus.chatbot.data.exception.InvalidInputException;
import rattus.chatbot.data.task.TaskList;
import rattus.chatbot.common.Message;

/**
* A storage for any task data that requires storing between sessions.
Expand Down Expand Up @@ -69,7 +70,7 @@ public static Storage from(String path) {
public static Storage of(File file) throws InvalidInputException {
assert (new File(DATA_STORAGE_PATH_PREFIX).exists());
if (!file.exists()) {
throw new InvalidInputException(Message.MESSAGE_INVALID_FILE_NAME);
throw new InvalidInputException(MESSAGE_INVALID_FILE_NAME);
}
return new Storage(file);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rattus/chatbot/ui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.io.IOException;

import rattus.chatbot.Rattus;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import rattus.chatbot.Rattus;

/**
* A GUI made with FXML for Duke.
Expand Down

0 comments on commit 570f4d7

Please sign in to comment.