File tree Expand file tree Collapse file tree 11 files changed +29
-11
lines changed Expand file tree Collapse file tree 11 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ checkstyle {
41
41
toolVersion = ' 10.2'
42
42
}
43
43
44
- run {
44
+ run {
45
45
standardInput = System . in
46
46
enableAssertions = true
47
47
}
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ ddf | dfdf | - | - | -
5
5
hello | bye | - | - | -
6
6
hello | bye | - | - | -
7
7
end program | hello | - | - | -
8
+ hello | world | - | - | -
Original file line number Diff line number Diff line change 4
4
5
5
import seedu .duke .flashcard .Flashcard ;
6
6
import seedu .duke .flashcard .FlashcardComponent ;
7
- import seedu .duke .calendar .Event ;
8
7
import seedu .duke .calendar .CalendarManager ;
8
+ import seedu .duke .calendar .Event ;
9
9
10
10
import java .util .ArrayList ;
11
11
import java .util .Scanner ;
@@ -18,7 +18,7 @@ public static void main(String[] args) {
18
18
}
19
19
20
20
private void runCalendar () {
21
- System .out .print ("Enter your command: " );
21
+ System .out .println ("Enter your command: " );
22
22
23
23
CalendarManager manager = new CalendarManager (new ArrayList <Event >());
24
24
@@ -72,7 +72,7 @@ private void run() {
72
72
String flashcardOrCalendar ;
73
73
Scanner scanner = new Scanner (System .in );
74
74
75
- System .out .print ("Do you choose flashcard or calendar? " );
75
+ System .out .println ("Do you choose flashcard or calendar? " );
76
76
flashcardOrCalendar = scanner .nextLine ();
77
77
78
78
if (flashcardOrCalendar .equals ("flashcard" )) {
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ public FlashcardComponent(ArrayList<Flashcard> flashcards) {
27
27
storage = new FlashcardStorage ("./data/flashcard.txt" );
28
28
try {
29
29
flashcardList = storage .loadFlashcards ();
30
- System .out .println ("Loading existed File" );
31
30
} catch (FileNotFoundException e ){
32
31
System .out .println ("Making New file" );
33
32
flashcardList = new FlashcardList (flashcards );
Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ public FlashcardDirectory(){
20
20
file = new File (path );
21
21
if (!file .exists ()){
22
22
if (file .mkdir ()){
23
- System .out .println ("Created data directory" );
23
+ System .out .println (" Created data directory" );
24
24
} else {
25
- System .out .println ("Failed to create directory" );
25
+ System .out .println (" Failed to create directory" );
26
26
}
27
27
} else {
28
- System .out .println ("Using data directory" );
28
+ System .out .println (" Using data directory" );
29
29
}
30
30
}
31
31
@@ -41,7 +41,7 @@ public void listFlashcardFiles(){
41
41
System .out .println ("No files exist" );
42
42
} else {
43
43
for (String flashcardFile : flashcardFiles ){
44
- System .out .println (flashcardFile );
44
+ System .out .println (" " + flashcardFile );
45
45
}
46
46
}
47
47
}
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ public ArrayList<Flashcard> getFlashcards() {
15
15
return flashcards ;
16
16
}
17
17
18
+ // @@author junhyeong0411
19
+ public int getSize (){
20
+ return flashcards .size ();
21
+ }
22
+
18
23
19
24
public void add (Flashcard flashcard ) {
20
25
flashcards .add (flashcard );
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ public boolean isStorageAvailable(){
33
33
* @return Flashcard object
34
34
*/
35
35
private Flashcard loadFlashcard (String [] tokens ){
36
+
37
+ assert tokens .length == 5 : "Token length should be 5" ;
38
+
36
39
String frontText = tokens [0 ].trim ();
37
40
String backText = tokens [1 ].trim ();
38
41
String [] tags = tokens [2 ].trim ().split ("/" );
@@ -82,11 +85,16 @@ public FlashcardList loadFlashcards() throws FileNotFoundException{
82
85
flashcardList .add (loadFlashcard (flashTokens ));
83
86
}
84
87
88
+ System .out .println (String .format (
89
+ " There are currently %d flashcards in the savefile" ,
90
+ flashcardList .getSize ()));
91
+
85
92
return flashcardList ;
86
93
87
94
}
88
95
89
96
public void saveFlashcards (ArrayList <Flashcard > flashcardList ) {
97
+
90
98
try {
91
99
FileWriter fw = new FileWriter (path );
92
100
Original file line number Diff line number Diff line change
1
+ Do you choose flashcard or calendar?
2
+ Enter your command:
Original file line number Diff line number Diff line change
1
+ Do you choose flashcard or calendar?
2
+ Enter your command:
Original file line number Diff line number Diff line change 1
- Enter the front page text:
1
+ Do you choose flashcard or calendar?
2
+ Enter your command:
You can’t perform that action at this time.
0 commit comments