Changed controllers to work with static variables and functions.
This commit is contained in:
parent
53eb04e12c
commit
c220a5376f
4 changed files with 12 additions and 12 deletions
|
@ -30,7 +30,7 @@ import java.util.*;
|
|||
*/
|
||||
|
||||
|
||||
public class MatchTheMeaningController extends Question implements Initializable{
|
||||
public class MatchTheMeaningController implements Initializable{
|
||||
|
||||
|
||||
private ArrayList<DictionaryEntry> answer =new ArrayList<>();
|
||||
|
@ -147,10 +147,10 @@ public class MatchTheMeaningController extends Question implements Initializable
|
|||
listOfAnswers.add(LeftWord4.getText());
|
||||
}
|
||||
|
||||
checkAnswer(answer,listOfAnswers,isEnglish);
|
||||
Question.checkAnswer(answer,listOfAnswers,isEnglish);
|
||||
|
||||
CorrectAnswer.setText(Integer.toString(correctAnswers));
|
||||
WrongAnswer.setText(Integer.toString(wrongAnswers));
|
||||
CorrectAnswer.setText(Integer.toString(Question.correctAnswers));
|
||||
WrongAnswer.setText(Integer.toString(Question.wrongAnswers));
|
||||
|
||||
answer.clear();
|
||||
this.prepare();
|
||||
|
|
|
@ -15,8 +15,8 @@ import java.util.ArrayList;
|
|||
*/
|
||||
public class Question {
|
||||
|
||||
public int correctAnswers = 0;
|
||||
public int wrongAnswers =0;
|
||||
public static int correctAnswers = 0;
|
||||
public static int wrongAnswers =0;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,7 +24,7 @@ public class Question {
|
|||
* @param listOfAnswers
|
||||
* @param isEnglish
|
||||
*/
|
||||
public void checkAnswer(ArrayList<DictionaryEntry> listOfCorrectQuestions, ArrayList<String>listOfAnswers, boolean isEnglish){
|
||||
public static void checkAnswer(ArrayList<DictionaryEntry> listOfCorrectQuestions, ArrayList<String>listOfAnswers, boolean isEnglish){
|
||||
if(isEnglish){
|
||||
for(int i=0; i<listOfCorrectQuestions.size();i++){
|
||||
if(listOfCorrectQuestions.get(i).getWelsh().equals(listOfAnswers.get(i))){
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.*;
|
|||
* @see uk.ac.aber.cs22120.group20.javafx.Application
|
||||
*/
|
||||
|
||||
public class SixMeaningsController extends TranslationController implements Initializable {
|
||||
public class SixMeaningsController implements Initializable {
|
||||
|
||||
private ArrayList<DictionaryEntry> wordSet = new ArrayList<>();
|
||||
public static ArrayList<DictionaryEntry> allQuestions = new ArrayList<>();
|
||||
|
|
|
@ -21,7 +21,7 @@ import uk.ac.aber.cs22120.group20.javafx.Application;
|
|||
* @version 0.1
|
||||
*
|
||||
*/
|
||||
public class TranslationController extends Question {
|
||||
public class TranslationController {
|
||||
private ArrayList<DictionaryEntry> practiceList = new ArrayList<>();
|
||||
public static DictionaryEntry answer = new DictionaryEntry();
|
||||
|
||||
|
@ -61,8 +61,8 @@ public class TranslationController extends Question {
|
|||
|
||||
submitButton.setImage(new Image ("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
|
||||
|
||||
correctGuesses.setText("Correct Guesses: " + correctAnswers);
|
||||
incorrectGuesses.setText("Incorrect Guesses: " + wrongAnswers);
|
||||
correctGuesses.setText("Correct Guesses: " + Question.correctAnswers);
|
||||
incorrectGuesses.setText("Incorrect Guesses: " + Question.wrongAnswers);
|
||||
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class TranslationController extends Question {
|
|||
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
|
||||
correctTranslation.add(answer);
|
||||
|
||||
checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish);
|
||||
Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish);
|
||||
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue