package cz.muni.fi.bronchus.questions; import java.util.Vector; /** * Class for storing general atributtes of the question like title, wording, type, duration, * hint, solution, weighting and response processing conditions. * @author Tomáš Udržal */ public abstract class Question { /** * Static array of identifiers of answers for generating response processing conditions */ protected static String[] answerLetters={"A","B","C","D","E","F","G","H","I","J", "K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; /** * Title of question */ private String title; /** * Wording of question */ private String wording; /** * Type of question i.e. "True/False" */ private String type; /** * Duration of question */ private String duration; /** * Vector of RespConditions */ private Vector respConditions; /** * Hint for question */ private String hint; /** * Solution of question */ private String solution; /** * Weighting of question */ private String weighting; /** * Creates a new instance of Question with specified type * @param s type of the question */ public Question(String s) { title=wording=duration=""; type=s; respConditions=new Vector(); weighting=null; } /** * Setter method for the title of this question * @param x title to be set */ public void setTitle(String x) { title=x; } /** * Getter method for the title of this question * @return title of question */ public String getTitle() { return title; } /** * Setter method for the wording of this question * @param x wording to be set */ public void setWording(String x) { wording=x; } /** * Getter method for the wording of this question * @return wording of question */ public String getWording() { return wording; } /** * Setter method for the duration of this question * @param x duration to be set */ public void setDuration(String x) { duration=x; } /** * Getter method for the duration of this question * @return duration of question */ public String getDuration() { return duration; } /** * Setter method for the type of this question * @param x type of question */ public void setType(String x) { type=x; } /** * Getter method for the type of this question * @return type of question */ public String getType() { return type; } /** * Adds response processing condition to the end of the Vector * @param x condition to be added */ public void addRespCondition(ResProcessingItem x) { respConditions.add(x); } /** * Get the response processing condition on the specified index * @param i index of the condition to be returned * @return response processing condition */ public ResProcessingItem getRespCondition(int i) { return (ResProcessingItem)respConditions.get(i); } /** * Getter method for the Vector of response processing conditions * @return Vector of response processing conditions */ public Vector getRespConditions() { return respConditions; } /** * Setter method for the hint of this question * @param x hint to be set */ public void setHint(String x) { hint=x;} /** * Getter method for the hint of this question * @return hint of question */ public String getHint() { return hint; } /** * Setter method for the solution of this question * @param x solution to be set */ public void setSolution(String x) { solution=x;} /** * Getter method for the solution of this question * @return solution of question */ public String getSolution() { return solution; } /** * Setter method for the weight of this question * @param x weight to be set */ public void setWeighting(String x) { weighting = x; } /** * Getter method for the weight of this question * @return weight of question */ public String getWeighting() { return weighting; } /** * Abstract method for generating response processing condition, which depend on * the selected answers. It's neccesarry to override this method in the childs * of question * @return generated response processing condition */ public abstract String generateCondition(); }