package cz.muni.fi.bronchus.questions; import java.util.Vector; /** * Connecting Objects Question. There are two lists of answers and the third one * with the reference for the connection of two answers. * Example 1: * * 3 AnswerA Answer1 * 2 AnswerB Answer2 * 1 AnswerC Answer3 * * Example 2: * 2 AnswerA Answer1 * 2 AnswerB Answer2 * 1 AnswerC * * @author Tomáš Udržal */ public class ConnectingObjectsQuestion extends Question { /** * Vector of answers's references - left column */ private Vector column1; /** * Vector of answers - middle column */ private Vector column2; /** * Vector of answers - right column */ private Vector column3; /** * Shuffle order of answers */ private boolean shuffle; /** Creates a new instance of ConnectingObjectsQuestion */ public ConnectingObjectsQuestion() { super("Connecting Objects"); column1=new Vector(); column2=new Vector(); column3=new Vector(); shuffle=false; } /** * Adds an answer's reference - left column - to the end of the Vector * @param x1 answer's reference to be add */ public void addAnswerColumn1(Integer x1) { column1.add(x1); } /** * Adds an answer - middle column - to the end of the Vector * @param x2 answer to be added */ public void addAnswerColumn2(String x2) { column2.add(x2); } /** * Adds an answer - right column - to the end of the Vector * @param x3 answer to be added */ public void addAnswerColumn3(String x3) { column3.add(x3); } /** * Getter method for the Vector of answers's referenced - left column * @return Vector of answers's references */ public Vector getAnswerColumn1() { return column1; } /** * Getter method for the Vector of answers - middle column * @return Vector of answers */ public Vector getAnswerColumn2() { return column2; } /** * Getter method for the Vector of answers - right column * @return Vector of answers */ public Vector getAnswerColumn3() { return column3; } /** * 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 (column1.size()==0) { //varianta odpovedi zadavani bez poradi for (int i=0; i