Skip to content

Commit b7a2573

Browse files
Merge pull request #82 from CSC207-2022F-UofT/5-feature-6-study-mode
completed javadoc
2 parents 758d016 + 28bb254 commit b7a2573

12 files changed

+199
-0
lines changed

src/main/java/study_mode_use_case/FlashcardStudierBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@
1616
*/
1717
public class FlashcardStudierBuilder {
1818

19+
/**
20+
* a class that knows how to create a flashcard
21+
*/
1922
FlashcardFactory cardFactory = new FlashcardFactory();
23+
24+
/**
25+
* a class that knows how to create a flashcard studier
26+
*/
2027
FlashcardStudierFactory studierFactory = new FlashcardStudierFactory();
28+
29+
/**
30+
* an object which accesses the database
31+
*/
2132
DBGateway gateway;
2233

2334
/**

src/main/java/study_mode_use_case/StudySessionController.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,40 @@
77
* @author Lucas Prates
88
*/
99
public class StudySessionController {
10+
/**
11+
* an interactor which controls the use case
12+
*/
1013
private final StudySessionInputBoundary inputBoundary;
1114

1215

16+
/**
17+
* a string which tells the system that the user wants to flip the flashcard
18+
*/
1319
public static String flip = StudySessionInputBoundary.flip;
20+
21+
/**
22+
* a string which tells the system that the user wants to gp to the next flashcard
23+
*/
1424
public static String next = StudySessionInputBoundary.next;
25+
26+
/**
27+
* a string which tells the system that the user wants to gp to the previous flashcard
28+
*/
1529
public static String prev = StudySessionInputBoundary.prev;
1630

31+
/**
32+
* a string which tells the system the user wants to shuffle randomly
33+
*/
1734
public static String shuffleSort = StudySessionInputBoundary.shuffleSort;
1835

36+
/**
37+
* a string which tells the system the user wants to sort by alphabetical order
38+
*/
1939
public static String alphSort = StudySessionInputBoundary.alphSort;
2040

41+
/**
42+
* a string which tells the system the user wants to sort by creation order
43+
*/
2144
public static String timeSort = StudySessionInputBoundary.timeSort;
2245

2346
/**

src/main/java/study_mode_use_case/StudySessionInputBoundary.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,34 @@
99

1010
public interface StudySessionInputBoundary {
1111

12+
/**
13+
* a string which tells the system that the user wants to flip the flashcard
14+
*/
1215
String flip = "flip";
16+
17+
/**
18+
* a string which tells the system that the user wants to gp to the next flashcard
19+
*/
1320
String next = "next";
21+
22+
/**
23+
* a string which tells the system that the user wants to gp to the previous flashcard
24+
*/
1425
String prev = "prev";
1526

27+
/**
28+
* a string which tells the system the user wants to shuffle randomly
29+
*/
1630
String shuffleSort = "shuffle";
31+
32+
/**
33+
* a string which tells the system the user wants to sort by alphabetical order
34+
*/
1735
String alphSort = "alph";
36+
37+
/**
38+
* a string which tells the system the user wants to sort by creation order
39+
*/
1840
String timeSort = "time";
1941

2042
/**

src/main/java/study_mode_use_case/StudySessionInteractor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@
1717
*/
1818
public class StudySessionInteractor implements StudySessionInputBoundary {
1919

20+
/**
21+
* a Flashcard Set which can handle study mode operations (flipping, going to next flashcard,
22+
* going to previous flashcard)
23+
*/
2024
private FlashcardStudier studier;
25+
26+
/**
27+
* an object which can prepare data for the view
28+
*/
2129
private final StudySessionOutputBoundary presenter;
2230

31+
/**
32+
* an object that knows how to build a flashcard studier
33+
*/
2334
private final FlashcardStudierBuilder builder;
2435

2536
/**

src/main/java/study_mode_use_case/StudySessionRequestModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* @author Lucas Prates
99
*/
1010
public class StudySessionRequestModel {
11+
/**
12+
* a string which specifies what the user wants to do
13+
*/
1114
private String command;
1215

1316
/**

src/main/java/study_mode_use_case/StudySessionResponseModel.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
* @author Lucas Prates
99
*/
1010
public class StudySessionResponseModel {
11+
/**
12+
* the text to be displayed on the on-screen flashcard
13+
*/
1114
private final String outputText;
15+
16+
/**
17+
* the position of the current flashcard in the flashcard set
18+
* starting at 1
19+
*/
1220
private final int cardNumber;
1321

1422
/**

src/main/java/study_mode_use_case/StudySettingsRequestModel.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,24 @@
99
* @author Lucas Prates
1010
*/
1111
public class StudySettingsRequestModel {
12+
/**
13+
* the id of the flashcard set to be studied
14+
*/
1215
private final int flashcardSetId;
16+
17+
/**
18+
* the user's desired sorting order
19+
*/
1320
private final String sortingOrder;
1421

22+
/**
23+
* a boolean specifying if the flashcard set should be sorted in order or in reverse
24+
*/
1525
private boolean isReverse = false;
26+
27+
/**
28+
* a boolean which specifies if the term or definition is displayed by default
29+
*/
1630
private final boolean termIsDefault;
1731

1832
/**

src/main/java/study_mode_use_case/StudySettingsResponseModel.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@
99
*/
1010
public class StudySettingsResponseModel extends StudySessionResponseModel {
1111

12+
/**
13+
* stores the length of the flashcard set
14+
*/
1215
private final int numFlashcards;
16+
/**
17+
* stores the title of the flashcard set
18+
*/
1319
private final String title;
20+
/**
21+
* stores the id of the flashcard set
22+
*/
1423
private final int flashcardSetId;
1524

1625
/**

src/main/java/study_mode_use_case/screens/StudySessionScreen.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,31 @@
1515
* Frameworks & Drivers
1616
* @author Lucas Prates
1717
*/
18+
1819
public class StudySessionScreen extends Screen implements ActionListener {
20+
/**
21+
* the study session controller
22+
*/
1923
private final StudySessionController controller;
24+
25+
/**
26+
* a JButton which handles flipping the flashcard
27+
*/
2028
private final JButton flip;
2129

30+
/**
31+
* stores the length of the flashcard set
32+
*/
2233
private final int numFlashcards;
2334

35+
/**
36+
* stores the text to be written to the on-screen flashcard
37+
*/
2438
private final JLabel cardLabel;
2539

40+
/**
41+
* the id of the flashcard set being studied
42+
*/
2643
private final int flashcardSetId;
2744

2845
/**

src/main/java/study_mode_use_case/screens/StudySettingsFailed.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package study_mode_use_case.screens;
22

3+
/**
4+
* An exception which is called if the study mode interactor fails to run
5+
*/
36
public class StudySettingsFailed extends RuntimeException {
47
public StudySettingsFailed(String error) {
58
super(error);

0 commit comments

Comments
 (0)