Skip to content

Commit 327b288

Browse files
committed
Fix checkstyle of the project.
1 parent 274cdce commit 327b288

File tree

11 files changed

+12
-31
lines changed

11 files changed

+12
-31
lines changed

docs/Ui.png

1.13 MB
Loading

src/main/java/devin/Devin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public String getResponse(String text) throws DevinException, IOException {
6666
- `event` \s
6767
- `find` \s
6868
- `schedule` \s
69-
7069
Try one of these!""");
7170
};
7271
}

src/main/java/devin/command/Command.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package devin.command;
22

33
import java.io.IOException;
4-
import java.util.ArrayList;
5-
import java.util.Collections;
6-
import java.util.Comparator;
74

85
import devin.Devin;
96
import devin.exception.DevinException;
@@ -189,7 +186,7 @@ public static String findCommand(TaskList list, String[] texts) throws DevinExce
189186

190187
/**
191188
* A schedule command to find all free time slot and display it to user.
192-
*
189+
*
193190
* @param list of all tasks.
194191
* @return a message showing all free time slot.
195192
*/

src/main/java/devin/main/MainWindow.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class MainWindow extends AnchorPane {
3737

3838
private AudioClip sendSound = new AudioClip(this.getClass().getResource("/sounds/Send.wav").toString());
3939
private AudioClip responseSound = new AudioClip(this.getClass().getResource("/sounds/Notification.wav").toString());
40-
4140
/**
4241
* Methods to start when the app first initialise
4342
*/
@@ -68,9 +67,9 @@ private void handleUserInput() {
6867
try {
6968
sendSound.play(1.0);
7069
String input = userInput.getText();
71-
assert input != null: "There is no user input.";
70+
assert input != null : "There is no user input.";
7271
String response = devin.getResponse(input);
73-
assert response != null: "There is no response.";
72+
assert response != null : "There is no response.";
7473
dialogContainer.getChildren().addAll(
7574
DialogBox.getUserDialog(input, userImage),
7675
DialogBox.getDevinDialog(response, devinImage)

src/main/java/devin/parser/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static String[] parseCommand(String input) throws DevinException {
3434
* @return the converted input.
3535
*/
3636
public static LocalDateTime parseDate(String input) {
37-
assert isValidDate(input): "Invalid date.";
37+
assert isValidDate(input) : "Invalid date.";
3838
return LocalDateTime.parse(input, FORMATTER);
3939
}
4040

src/main/java/devin/storage/Storage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public class Storage {
2929
*/
3030
public Storage(Path filePath) {
3131
this.filePath = filePath;
32-
assert filePath != null: "There is no file path.";
32+
assert filePath != null : "There is no file path.";
3333
this.parentDir = filePath.getParent();
34-
assert parentDir != null: "There is no parent directory.";
34+
assert parentDir != null : "There is no parent directory.";
3535
}
3636

3737
/**

src/main/java/devin/task/Deadline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Deadline(String description, LocalDateTime by, boolean isDone) {
2626

2727
@Override
2828
public LocalDateTime getEndTime() {
29-
return by;
29+
return by;
3030
}
3131

3232
@Override

src/main/java/devin/task/Event.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,4 @@ public String toFileString() {
4646
public String toString() {
4747
return "[E]" + super.toString() + " (from: " + from.format(FORMATTER2) + " to: " + to.format(FORMATTER2) + ")";
4848
}
49-
5049
}

src/main/java/devin/task/Task.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ public void markTask() {
5151
public void unmarkTask() {
5252
this.isDone = false;
5353
}
54-
5554
public LocalDateTime getStartTime() {
5655
return null;
5756
}
58-
5957
public LocalDateTime getEndTime() {
6058
return null;
6159
}
@@ -68,6 +66,4 @@ public String toFileString() {
6866
public String toString() {
6967
return "[" + getStatusIcon() + "] " + this.name;
7068
}
71-
72-
7369
}

src/main/java/devin/task/TaskList.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package devin.task;
22

33
import java.io.IOException;
4-
import java.time.Duration;
54
import java.time.LocalDateTime;
65
import java.time.format.DateTimeFormatter;
76
import java.util.ArrayList;
8-
import java.util.Collections;
97
import java.util.Comparator;
108
import java.util.regex.Matcher;
119
import java.util.regex.Pattern;
@@ -42,7 +40,7 @@ public TaskList(ArrayList<Task> tasks) {
4240
public void addTask(Devin.Type type, String input, Storage storage) throws DevinException, IOException {
4341
Task task;
4442
String[] temp = Parser.parseInput(type, input);
45-
assert temp.length > 0: "There should be at least one task.";
43+
assert temp.length > 0 : "There should be at least one task.";
4644
switch (type) {
4745
case todo:
4846
if (input.trim().isEmpty()) {
@@ -73,7 +71,7 @@ public String listTasks() {
7371
for (int i = 0; i < tasks.size(); i++) {
7472
out.append(i + 1).append(". ").append(tasks.get(i).toString()).append("\n");
7573
}
76-
assert !out.isEmpty() : "There is nothing in out." ;
74+
assert !out.isEmpty() : "There is nothing in out.";
7775
return out.toString();
7876
}
7977

@@ -136,22 +134,18 @@ public ArrayList<Task> getTasks() {
136134

137135
/**
138136
* Find all the free time slot that the user can schedule.
139-
*
137+
*
140138
* @return a message of all free time slot
141139
*/
142140
public String getTimedTasks() {
143141
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d/M/yyyy HHmm");
144-
145142
LocalDateTime now = LocalDateTime.now();
146-
147143
ArrayList<Task> timedTasks = tasks.stream()
148144
.filter(task -> task.getStartTime() != null && task.getEndTime() != null)
149145
.sorted(Comparator.comparing(Task::getStartTime))
150146
.collect(Collectors.toCollection(ArrayList::new));
151-
152147
StringBuilder freeSlots = new StringBuilder();
153148
LocalDateTime previousEndTime = now;
154-
155149
for (Task task : timedTasks) {
156150
if (previousEndTime.isBefore(task.getStartTime())) {
157151
freeSlots.append("Free slot from ")
@@ -162,12 +156,10 @@ public String getTimedTasks() {
162156
}
163157
previousEndTime = task.getEndTime();
164158
}
165-
166159
freeSlots.append("Free slot from ")
167160
.append(previousEndTime.format(formatter))
168161
.append(" to forever")
169-
.append("\n");
170-
162+
.append("\n");
171163
return freeSlots.toString().trim();
172164
}
173165
}

0 commit comments

Comments
 (0)