| 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.Set;
- /**
- * @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 Set<String> tags;
- protected Set<String> knowledgeId;
- private Date lastModified;
- 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:
- return null;
- }
- }
- public BaseQuestionVO(BokQuestion bokQuestion) {
- this.id = bokQuestion.getId();
- this.stem = bokQuestion.getStem();
- this.keyPoints = bokQuestion.getKeyPoints();
- this.tags = bokQuestion.getTags();
- this.knowledgeId = bokQuestion.getKnowledgeId();
- this.lastModified = bokQuestion.getLastModified();
- }
- /**
- * 检查答案是否正确
- *
- * @param answer 答案
- * @return 是否正确
- */
- public abstract boolean pass(Object answer);
- }
|