File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/main/java/seedu/duke/calendar/command Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@@author wendelinwemhoener-reused
2
+
3
+ package seedu .duke .calendar .command ;
4
+
5
+ import seedu .duke .calendar .EventList ;
6
+
7
+ import java .util .Scanner ;
8
+
9
+ public abstract class DualEventCommand extends EventCommand {
10
+ protected int beginnerCommandLength ;
11
+ protected int expertCommandLength ;
12
+ protected String input ;
13
+ protected String syntaxString ;
14
+
15
+ protected abstract void executeBeginnerMode (Scanner scanner , EventList eventList );
16
+
17
+ protected abstract void executeExpertMode (Scanner scanner ,
18
+ EventList eventList );
19
+
20
+ public void execute (Scanner scanner , EventList eventList ) {
21
+ String [] commandParts = input .split (" " );
22
+
23
+ if (commandParts .length == beginnerCommandLength ) {
24
+ executeBeginnerMode (scanner , eventList );
25
+ } else if (commandParts .length == expertCommandLength ) {
26
+ executeExpertMode (scanner , eventList );
27
+ } else {
28
+ System .out .println (" Invalid syntax! The syntax is '" + syntaxString + "'" );
29
+ System .out .println (" Please try again." );
30
+ }
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments