package nju.seec.helper.vo.question; import lombok.Data; import lombok.NonNull; import nju.seec.helper.util.enums.ExceptionType; import nju.seec.helper.util.enums.QuestionType; import nju.seec.helper.util.exception.HelperException; /** * @author XuShengTao *

* updated by cst */ @Data public abstract class BaseQuestionVO { protected String id; protected QuestionType type; protected String stem; protected String analysis; public static BaseQuestionVO convertBokQuestionToVO(@NonNull BokQuestion bokQuestion, boolean withAnswer) { switch (bokQuestion.getType()) { case "choice": return new ChoiceQuestionVO(bokQuestion, withAnswer); case "true_false": return new TrueOrFalseQuestionVO(bokQuestion, withAnswer); default: throw HelperException.of(ExceptionType.ERROR, "无法解析该题目"); } } /** * 检查答案是否正确 * * @param answer * @return */ public abstract boolean pass(Object answer); }