1
+ //@@author wendelinwemhoener
2
+
1
3
package seedu .duke .flashcard ;
2
4
3
5
import seedu .duke .flashcard .command .FlashcardCommand ;
@@ -16,6 +18,8 @@ public class FlashcardComponent {
16
18
17
19
public FlashcardComponent (ArrayList <Flashcard > flashcards ) {
18
20
parser = new FlashcardCommandParser ();
21
+
22
+ //@@author junhyeong0411
19
23
storage = new FlashcardStorage ("./flashcard.txt" );
20
24
try {
21
25
flashcardList = storage .loadFlashcards ();
@@ -25,9 +29,8 @@ public FlashcardComponent(ArrayList<Flashcard> flashcards) {
25
29
flashcardList = new FlashcardList (flashcards );
26
30
}
27
31
28
-
32
+ //@@author wendelinwemhoener
29
33
ui = new FlashcardUi (flashcardList );
30
-
31
34
}
32
35
33
36
public boolean isResponsible (String input ) {
@@ -42,9 +45,15 @@ public boolean isResponsible(String input) {
42
45
43
46
public void processInput (String input ) {
44
47
FlashcardCommand command = parser .parseInput (input );
48
+ assert !(command instanceof UnknownCommand ) : "Command cannot be " +
49
+ "unknown" ;
50
+
45
51
ui .executeCommand (command );
46
52
53
+ //@@author junhyeong0411
47
54
// save after every commands
48
55
storage .saveFlashcards (flashcardList .getFlashcards ());
56
+
57
+ //@@author wendelinwemhoener
49
58
}
50
59
}
0 commit comments