Skip to content

Commit f0693f5

Browse files
authored
Merge pull request nus-cs2113-AY2324S1#3 from AY2324S1-CS2113-F11-3/master
Update
2 parents 5849153 + b6dd7c8 commit f0693f5

16 files changed

+272
-2
lines changed

src/main/java/seedu/duke/Duke.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import seedu.duke.flashcard.Flashcard;
66
import seedu.duke.flashcard.FlashcardComponent;
7+
import seedu.duke.flashcard.FlashcardDirectory;
78

89
import java.util.ArrayList;
910
import java.util.Scanner;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package seedu.duke.calendar;
2+
3+
public class Calendar {
4+
EventStorage eventStorage;
5+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package seedu.duke.calendar;
2+
3+
import seedu.duke.calendar.command.AddEventCommand;
4+
import seedu.duke.calendar.command.DeleteEventCommand;
5+
import seedu.duke.calendar.command.EventCommand;
6+
import seedu.duke.calendar.command.ListCalendarEventsCommand;
7+
import seedu.duke.calendar.command.UnknownCommand;
8+
9+
public class CalendarCommandParser {
10+
public EventCommand parseInput(String input) {
11+
assert input != null : "input is null";
12+
13+
if (input.startsWith("add event")) {
14+
return new AddEventCommand();
15+
} else if (input.startsWith("delete event")) {
16+
return new DeleteEventCommand();
17+
} else if (input.startsWith("list event")) {
18+
return new ListCalendarEventsCommand();
19+
}
20+
21+
return new UnknownCommand();
22+
}
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package seedu.duke.calendar;
2+
3+
public class CalendarManager {
4+
Calendar calendar;
5+
CalendarUi calendarUi;
6+
CalendarCommandParser calendarCommandParser;
7+
8+
public CalendarManager() {
9+
calendar = new Calendar();
10+
calendarUi = new CalendarUi();
11+
calendarCommandParser = new CalendarCommandParser();
12+
}
13+
14+
public void start() {
15+
16+
}
17+
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package seedu.duke.calendar;
2+
3+
public class CalendarUi {
4+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package seedu.duke.calendar;
2+
3+
import java.time.LocalDate;
4+
5+
public class Event {
6+
String name;
7+
LocalDate from;
8+
LocalDate to;
9+
10+
public Event(String name, LocalDate from, LocalDate to) {
11+
this.name = name;
12+
this.from = from;
13+
this.to = to;
14+
}
15+
16+
public String getName() {
17+
return name;
18+
}
19+
20+
public void setName(String name) {
21+
this.name = name;
22+
}
23+
24+
public LocalDate getFrom() {
25+
return from;
26+
}
27+
28+
public void setFrom(LocalDate from) {
29+
this.from = from;
30+
}
31+
32+
public LocalDate getTo() {
33+
return to;
34+
}
35+
36+
public void setTo(LocalDate to) {
37+
this.to = to;
38+
}
39+
40+
@Override
41+
public String toString() {
42+
return "Event{" +
43+
"name='" + name + '\'' +
44+
", from=" + from +
45+
", to=" + to +
46+
'}';
47+
}
48+
49+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package seedu.duke.calendar;
2+
3+
import java.time.LocalDate;
4+
import java.util.ArrayList;
5+
import java.util.TreeMap;
6+
7+
public class EventStorage {
8+
ArrayList<Event> events;
9+
10+
public EventStorage() {
11+
events = new ArrayList<>();
12+
}
13+
14+
public void addEvent(String name, LocalDate from, LocalDate to) {
15+
events.add(new Event(name, from, to));
16+
}
17+
18+
public boolean delEvent(String name) {
19+
for(Event event : events) {
20+
if (event.getName().equals(name)) {
21+
events.remove(event);
22+
return true;
23+
}
24+
}
25+
return false;
26+
}
27+
@Override
28+
public String toString() {
29+
return "EventStorage{" +
30+
"events=" + events +
31+
'}';
32+
}
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package seedu.duke.calendar.command;
2+
3+
public class AddEventCommand extends EventCommand{
4+
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package seedu.duke.calendar.command;
2+
3+
public class DeleteEventCommand extends EventCommand{
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package seedu.duke.calendar.command;
2+
3+
public abstract class EventCommand {
4+
5+
}

0 commit comments

Comments
 (0)