forked from nus-cs2103-AY1920S1/addressbook-level3
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
110 additions
and
22 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
36 changes: 36 additions & 0 deletions
36
src/main/java/seedu/address/logic/commands/NextQuestionCommand.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,36 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.parser.KeyboardFlashCardsParser; | ||
import seedu.address.model.Model; | ||
|
||
/** | ||
* Instantiates a NextQuestionCommand to skip questions. | ||
*/ | ||
public class NextQuestionCommand extends Command { | ||
|
||
public static final String MESSAGE_SUCCESS_END_OF_TEST = "End of test!"; | ||
|
||
private final KeyboardFlashCardsParser keyboardFlashCardsParser; | ||
private final String messageSuccess; | ||
|
||
public NextQuestionCommand(KeyboardFlashCardsParser keyboardFlashCardsParser, String messageSuccess) { | ||
this.keyboardFlashCardsParser = keyboardFlashCardsParser; | ||
this.messageSuccess = messageSuccess; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
requireNonNull(model); | ||
if (!model.hasTestFlashCard()) { | ||
keyboardFlashCardsParser.endTestMode(); | ||
model.endFlashCardTest(); | ||
return new CommandResult(MESSAGE_SUCCESS_END_OF_TEST); | ||
} | ||
|
||
String nextQuestion = model.getTestQuestion(); | ||
keyboardFlashCardsParser.setAwaitingAnswer(true); | ||
return new CommandResult(String.format(messageSuccess, nextQuestion)); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/seedu/address/logic/commands/SkipCommand.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,25 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import seedu.address.logic.parser.KeyboardFlashCardsParser; | ||
import seedu.address.model.Model; | ||
|
||
/** | ||
* This creates a SkipCommand object that allows users to skip the current question. | ||
*/ | ||
public class SkipCommand extends NextQuestionCommand { | ||
|
||
public static final String COMMAND_WORD = "skip"; | ||
public static final String MESSAGE_SUCCESS = "Successfully skipped question! Here's the next question:\n%s"; | ||
public static final String ERROR_MESSAGE = "You can only skip after seeing the question!\n" | ||
+ "Next available command: rate, end"; | ||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Skips a flashcard and gets the next question."; | ||
|
||
public SkipCommand(KeyboardFlashCardsParser keyboardFlashCardsParser) { | ||
super(keyboardFlashCardsParser, MESSAGE_SUCCESS); | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
return super.execute(model); | ||
} | ||
} |
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 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