package cz.muni.fi.bronchus.questions; /** * Standard True/False question, two choices, one is correct. * @author Tomáš Udržal */ public class TrueFalseQuestion extends Question { /** * Index of correct answer */ private int correctAnswerIndex; /** * Wording of answer 1 */ private String answer1Wording; /** * Wording of answer 2 */ private String answer2Wording; /** * Horizontally adjustment of answers */ private boolean horizontally; /** * Shuffle order of answers */ private boolean shuffle; /** Creates a new instance of TrueFalseQuestion */ public TrueFalseQuestion() { super("True/False"); answer1Wording=answer2Wording=""; correctAnswerIndex=0; horizontally=true; shuffle=false; } /** * Setter method for the index of the true answer * @param x index of true answer */ public void setCorrectAnswerIndex(int x) { correctAnswerIndex=x; } /** * Getter method for the index of the correct answer * @return index of the correct answer */ public int getCorrectAnswerIndex() { return correctAnswerIndex; } /** * Setter method for the wording of answer 1 * @param x wording of answer 1 */ public void setAnswer1Wording(String x) { answer1Wording=x; } /** * Getter method for the wording of answer 1 * @return wording of answer 1 */ public String getAnswer1Wording() { return answer1Wording; } /** * Setter method for the wording of answer 2 * @param x wording of answer 2 */ public void setAnswer2Wording(String x) { answer2Wording=x; } /** * Getter method for the wording of answer 2 * @return wording of answer 2 */ public String getAnswer2Wording() { return answer2Wording; } /** * Setter method for the adjustment of answers * @param x true if horizontally false if vertically */ public void setHorizontally(boolean x) { horizontally=x; } /** * Getter method for the adjustment of answers * @return true if horizontally false if vertically */ public boolean isHorizontally() { return horizontally; } /** * Setter method for the shuffle of answers * @param x true if shuffle of answers is enabled otherwise false */ public void setShuffle(boolean x) { shuffle=x; } /** * Getter method for the shuffle of answers * @return true if shuffle of answers is enabled otherwise false */ public boolean isShuffle() { return shuffle; } /** * Method for generating a response processing condition from a selected answers * @return response processing condition */ public String generateCondition() { String s=""; if (correctAnswerIndex==0) s="A==true"; if (correctAnswerIndex==1) s="B==true"; return s; } }