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