Skip to content

Commit 060332a

Browse files
Glenn LeeGlenn Lee
authored andcommitted
A-Packages
1 parent 9cc5c7c commit 060332a

10 files changed

Lines changed: 41 additions & 1 deletion

File tree

src/main/java/Checklst.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
import java.nio.file.InvalidPathException;
44
import java.nio.file.Paths;
55

6+
import parser.Parser;
7+
import storage.Storage;
8+
import task.TaskList;
9+
import ui.Ui;
10+
611
public class Checklst {
712

813
public static void main(String[] args) {

src/main/java/ChecklstException.java renamed to src/main/java/exception/ChecklstException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exception;
2+
13
public class ChecklstException extends Exception {
24

35
/**
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
package parser;
2+
3+
import task.Event;
4+
import exception.ChecklstException;
5+
import storage.Storage;
6+
import task.Deadline;
7+
import task.Task;
8+
import task.TaskList;
9+
import task.Todo;
10+
import ui.Ui;
11+
112
public class Parser {
213

314
public void parse(String[] input, Ui ui, TaskList taskList, Storage storage) {
@@ -35,7 +46,7 @@ public void parse(String[] input, Ui ui, TaskList taskList, Storage storage) {
3546
throw new ChecklstException("Sorry I didn't understand that command!!");
3647
}
3748
} catch (ChecklstException e) {
38-
storage.removeLastCommand();
49+
storage.removeLastCommand(); // Remove invalid commands
3950
ui.sendOutput(e.getMessage());
4051
}
4152
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
package storage;
2+
13
import java.io.FileNotFoundException;
24
import java.io.FileOutputStream;
35
import java.io.PrintStream;
46
import java.util.ArrayList;
57

8+
import exception.ChecklstException;
9+
610
public class Storage {
711

812
private final ArrayList<String> commandHistory;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
package task;
2+
13
import java.time.LocalDate;
24
import java.time.format.DateTimeFormatter;
35
import java.time.format.DateTimeParseException;
46

7+
import exception.ChecklstException;
8+
59
public class Deadline extends Task {
610

711
protected final LocalDate dueDate;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
package task;
2+
13
import java.time.LocalDate;
24
import java.time.format.DateTimeFormatter;
35
import java.time.format.DateTimeParseException;
46

7+
import exception.ChecklstException;
8+
59
public class Event extends Task {
610

711
protected final LocalDate dateTime;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package task;
2+
13
public abstract class Task {
24

35
protected final String name;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
package task;
2+
13
import java.util.ArrayList;
24

5+
import exception.ChecklstException;
6+
37
public class TaskList {
48

59
private final ArrayList<Task> taskList = new ArrayList<>();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package task;
2+
13
public class Todo extends Task {
24

35
/**
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package ui;
2+
13
import java.util.Scanner;
24

35
public class Ui {

0 commit comments

Comments
 (0)