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<>();
|
private ArrayList<DictionaryEntry> answer =new ArrayList<>();
|
||||||
|
@ -147,10 +147,10 @@ public class MatchTheMeaningController extends Question implements Initializable
|
||||||
listOfAnswers.add(LeftWord4.getText());
|
listOfAnswers.add(LeftWord4.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAnswer(answer,listOfAnswers,isEnglish);
|
Question.checkAnswer(answer,listOfAnswers,isEnglish);
|
||||||
|
|
||||||
CorrectAnswer.setText(Integer.toString(correctAnswers));
|
CorrectAnswer.setText(Integer.toString(Question.correctAnswers));
|
||||||
WrongAnswer.setText(Integer.toString(wrongAnswers));
|
WrongAnswer.setText(Integer.toString(Question.wrongAnswers));
|
||||||
|
|
||||||
answer.clear();
|
answer.clear();
|
||||||
this.prepare();
|
this.prepare();
|
||||||
|
|
|
@ -15,8 +15,8 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class Question {
|
public class Question {
|
||||||
|
|
||||||
public int correctAnswers = 0;
|
public static int correctAnswers = 0;
|
||||||
public int wrongAnswers =0;
|
public static int wrongAnswers =0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -24,7 +24,7 @@ public class Question {
|
||||||
* @param listOfAnswers
|
* @param listOfAnswers
|
||||||
* @param isEnglish
|
* @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){
|
if(isEnglish){
|
||||||
for(int i=0; i<listOfCorrectQuestions.size();i++){
|
for(int i=0; i<listOfCorrectQuestions.size();i++){
|
||||||
if(listOfCorrectQuestions.get(i).getWelsh().equals(listOfAnswers.get(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
|
* @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<>();
|
private ArrayList<DictionaryEntry> wordSet = new ArrayList<>();
|
||||||
public static ArrayList<DictionaryEntry> allQuestions = new ArrayList<>();
|
public static ArrayList<DictionaryEntry> allQuestions = new ArrayList<>();
|
||||||
|
|
|
@ -21,7 +21,7 @@ import uk.ac.aber.cs22120.group20.javafx.Application;
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TranslationController extends Question {
|
public class TranslationController {
|
||||||
private ArrayList<DictionaryEntry> practiceList = new ArrayList<>();
|
private ArrayList<DictionaryEntry> practiceList = new ArrayList<>();
|
||||||
public static DictionaryEntry answer = new DictionaryEntry();
|
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"));
|
submitButton.setImage(new Image ("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
|
||||||
|
|
||||||
correctGuesses.setText("Correct Guesses: " + correctAnswers);
|
correctGuesses.setText("Correct Guesses: " + Question.correctAnswers);
|
||||||
incorrectGuesses.setText("Incorrect Guesses: " + wrongAnswers);
|
incorrectGuesses.setText("Incorrect Guesses: " + Question.wrongAnswers);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class TranslationController extends Question {
|
||||||
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
|
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
|
||||||
correctTranslation.add(answer);
|
correctTranslation.add(answer);
|
||||||
|
|
||||||
checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish);
|
Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue