@@ -18,6 +18,12 @@ public class CalendarManager {
18
18
19
19
private EventStorage storage ;
20
20
21
+ /**
22
+ * The CalendarManager initializes the accesses to other classes.
23
+ * It also loads events from the storage.
24
+ * @param events is used to initialize the EventList.
25
+ */
26
+
21
27
public CalendarManager (ArrayList <Event > events ) {
22
28
23
29
EventDirectory eventdirectory = new EventDirectory ();
@@ -39,32 +45,46 @@ public CalendarManager(ArrayList<Event> events) {
39
45
40
46
}
41
47
48
+ // getStorage is used for getting the storage
42
49
public EventStorage getStorage (){
43
50
return this .storage ;
44
51
}
45
52
53
+ /**
54
+ * validCommand is used for checking whether the command is valid, and
55
+ * not an instance of UnknownCommand.
56
+ * @param input is used for converting the input into command.
57
+ * @return returns whether the command is instance of UnknownCommand or not.
58
+ */
59
+
46
60
public boolean validCommand (String input ) {
47
61
EventCommand command = calendarCommandParser .parseInput (input );
48
62
49
63
return !(command instanceof UnknownCommand );
50
64
}
51
65
66
+ // isResponsible calls the validCommand method.
52
67
public boolean isResponsible (String input ) {
53
68
return validCommand (input );
54
69
}
55
70
71
+ // processInput is used for saving the events in the EventList.
56
72
public void processInput (String input ) {
57
73
startCalendar (input );
58
74
59
75
storage .saveEvents (eventList .getEvent ());
60
76
}
61
77
78
+ /**
79
+ * startCalender starts the Calendar features and uses the input as a command.
80
+ * @param input is used for converting the input into command.
81
+ */
82
+
62
83
public void startCalendar (String input ) {
63
84
EventCommand command = calendarCommandParser .parseInput (input );
64
85
assert !(command instanceof seedu .duke .calendar .command .UnknownCommand ) :
65
86
"Command cannot be " + "unknown" ;
66
87
calendarUi .executeCommand (command );
67
88
//calendarCommandParser.parseInput(command);
68
89
}
69
-
70
90
}
0 commit comments