Added changes to TranslationController.java to work with eventual implementation of AssessmentGenerator.

This commit is contained in:
Brad Corbett 2020-04-29 11:22:02 +01:00
parent ddb70a042c
commit 1b8cc34bf8

View file

@ -22,7 +22,8 @@ import uk.ac.aber.cs22120.group20.javafx.Application;
* *
*/ */
public class TranslationController extends Question { public class TranslationController extends Question {
ArrayList<DictionaryEntry> practiceList = new ArrayList<>(); private ArrayList<DictionaryEntry> practiceList = new ArrayList<>();
public static DictionaryEntry practiceWord = new DictionaryEntry();
/** /**
* Represents the word that will be randomly chosen from the practiceList. * Represents the word that will be randomly chosen from the practiceList.
@ -60,19 +61,16 @@ public class TranslationController extends Question {
submitButton.setImage(new Image ("file:src/main/resources/assets/icons/black_icons/50px/right-50.png")); submitButton.setImage(new Image ("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
practiceList.addAll(Application.practiseList);
chosenWord = (rand.nextInt(practiceList.size()));
correctGuesses.setText("Correct Guesses: " + correctAnswers); correctGuesses.setText("Correct Guesses: " + correctAnswers);
incorrectGuesses.setText("Incorrect Guesses: " + wrongAnswers); incorrectGuesses.setText("Incorrect Guesses: " + wrongAnswers);
if(AssessmentGenerator.isEnglish){ if(AssessmentGenerator.isEnglish){
wordToTranslate.setText(practiceList.get(chosenWord).getWelsh()); wordToTranslate.setText(practiceWord.getWelsh());
} }
else{ else{
wordToTranslate.setText(practiceList.get(chosenWord).getEnglish()); wordToTranslate.setText(practiceWord.getEnglish());
} }
} }