| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package nju.seec.helper.vo.question;
- import lombok.Data;
- import lombok.NonNull;
- import nju.seec.helper.api.bok.constant.QuestionType;
- import nju.seec.helper.api.bok.vo.QuestionVO;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @author XuShengTao
- * <p>
- * updated by cst
- */
- @Data
- public abstract class BaseQuestionVO {
- protected String id;
- protected QuestionType type;
- protected Map<String, String> options;
- protected String stem;
- protected String analysis;
- protected String keyPoints;
- protected List<String> tags;
- protected List<String> knowledgeId;
- protected Date lastModified;
- public static BaseQuestionVO convertBokQuestionToVO(@NonNull QuestionVO questionVO, boolean withAnswer) {
- switch (questionVO.getType()) {
- case choice:
- return new ChoiceQuestionVO(questionVO, withAnswer);
- case true_false:
- return new TrueOrFalseQuestionVO(questionVO, withAnswer);
- default:
- return null;
- }
- }
- protected BaseQuestionVO(QuestionVO questionVO) {
- this.id = questionVO.getId();
- this.type = questionVO.getType();
- this.options = questionVO.getOptions();
- this.stem = questionVO.getStem();
- this.keyPoints = questionVO.getKeyPoints();
- this.tags = questionVO.getTags();
- this.knowledgeId = questionVO.getKnowledgeId();
- this.lastModified = questionVO.getLastModifiedTime();
- }
- /**
- * 检查答案是否正确
- *
- * @param answer 答案
- * @return 是否正确
- */
- public abstract boolean pass(Object answer);
- }
|