forked from nus-cs2113-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2113-AY2324S1#12 from wendelinwemhoener/impr…
…ove-flashcard-support Improve flashcard support
- Loading branch information
Showing
22 changed files
with
260 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ checkstyle { | |
|
||
run{ | ||
standardInput = System.in | ||
enableAssertions = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# John Doe - Project Portfolio Page | ||
# Wendelin Wemhoener - Project Portfolio Page | ||
|
||
## Overview | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dfdfdf | aaaaaaaaaaaaaaaaaaa | - | - | - | ||
flash1 | dfdfdf | - | - | - | ||
adfdf | dfdfdf | - | - | - | ||
dfdfdf | dfdfdfdfdf | - | - | - | ||
who is this | me | - | - | - | ||
dfdfdfdaaaaaaaaaaaaa | dd | - | - | - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard; | ||
|
||
import java.util.ArrayList; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/seedu/duke/flashcard/command/FlashcardCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.command; | ||
|
||
import seedu.duke.flashcard.FlashcardList; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 53 additions & 1 deletion
54
src/main/java/seedu/duke/flashcard/command/StartReviewCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,63 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.command; | ||
|
||
import seedu.duke.flashcard.FlashcardList; | ||
import seedu.duke.flashcard.review.FlashcardReview; | ||
import seedu.duke.flashcard.review.RandomReviewMode; | ||
import seedu.duke.flashcard.review.ReviewByTagMode; | ||
import seedu.duke.flashcard.review.ReviewMode; | ||
import seedu.duke.flashcard.review.SpacedRepetitionReviewMode; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Scanner; | ||
|
||
public class StartReviewCommand extends FlashcardCommand { | ||
private final ArrayList<String> choices = new ArrayList<>(Arrays.asList( | ||
"a", "b", "c")); | ||
|
||
private String getUserChoiceReviewMode(Scanner scanner) { | ||
System.out.println(" How do you want to review your flashcards?"); | ||
System.out.println(" a) random mode"); | ||
System.out.println(" b) spaced repetition mode"); | ||
System.out.println(" c) review by tag mode"); | ||
|
||
return scanner.nextLine(); | ||
} | ||
|
||
public void execute(Scanner scanner, FlashcardList flashcardList) { | ||
System.out.println(""); | ||
String choice = getUserChoiceReviewMode(scanner); | ||
|
||
if (!choices.contains(choice)) { | ||
System.out.println(" Invalid choice! Your choice must be a, b " + | ||
"or c!"); | ||
return; | ||
} | ||
|
||
ReviewMode reviewMode = createReviewMode(choice, flashcardList); | ||
|
||
if (reviewMode instanceof RandomReviewMode) { | ||
reviewMode.startReviewSession(scanner); | ||
} else { | ||
System.out.println("This review mode hasn't yet been implemented." + | ||
" Sorry!"); | ||
} | ||
} | ||
|
||
private ReviewMode createReviewMode(String choice, FlashcardList flashcardList) { | ||
ReviewMode reviewMode = null; | ||
|
||
if (choice.equals("a")) { | ||
reviewMode = new RandomReviewMode(flashcardList); | ||
} else if (choice.equals("b")) { | ||
reviewMode = new SpacedRepetitionReviewMode(flashcardList); | ||
} else if (choice.equals("c")) { | ||
reviewMode = new ReviewByTagMode(flashcardList); | ||
} | ||
|
||
assert reviewMode != null; | ||
|
||
return reviewMode; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/main/java/seedu/duke/flashcard/command/UnknownCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.command; | ||
|
||
import seedu.duke.flashcard.FlashcardList; | ||
|
15 changes: 15 additions & 0 deletions
15
src/main/java/seedu/duke/flashcard/review/FlashcardReview.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.review; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class FlashcardReview { | ||
private LocalDateTime reviewDate; | ||
private ReviewDifficulty reviewDifficulty; | ||
|
||
public FlashcardReview(LocalDateTime reviewDate, ReviewDifficulty reviewDifficulty) { | ||
this.reviewDate = reviewDate; | ||
this.reviewDifficulty = reviewDifficulty; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/seedu/duke/flashcard/review/RandomReviewMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.review; | ||
|
||
import seedu.duke.flashcard.Flashcard; | ||
import seedu.duke.flashcard.FlashcardList; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Random; | ||
|
||
public class RandomReviewMode extends ReviewMode { | ||
public RandomReviewMode(FlashcardList flashcardList) { | ||
super(flashcardList); | ||
} | ||
|
||
public String getReviewModeName() { | ||
return "random review mode"; | ||
} | ||
|
||
protected Flashcard pickFlashcard() { | ||
ArrayList<Flashcard> flashcards = flashcardList.getFlashcards(); | ||
Random random = new Random(); | ||
|
||
return flashcards.get(random.nextInt(flashcards.size())); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/seedu/duke/flashcard/review/ReviewByTagMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package seedu.duke.flashcard.review; | ||
|
||
import seedu.duke.flashcard.Flashcard; | ||
import seedu.duke.flashcard.FlashcardList; | ||
|
||
public class ReviewByTagMode extends ReviewMode { | ||
public ReviewByTagMode(FlashcardList flashcardList) { | ||
super(flashcardList); | ||
} | ||
|
||
public String getReviewModeName() { | ||
return "review by tag mode"; | ||
} | ||
|
||
protected Flashcard pickFlashcard() { | ||
return null; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/seedu/duke/flashcard/review/ReviewDifficulty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@@author wendelinwemhoener | ||
|
||
package seedu.duke.flashcard.review; | ||
|
||
public enum ReviewDifficulty { | ||
EASY, | ||
GOOD, | ||
HARD, | ||
AGAIN | ||
} |
Oops, something went wrong.