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
*
* updated by cst
*/
@Data
public abstract class BaseQuestionVO {
protected String id;
protected QuestionType type;
protected Map options;
protected String stem;
protected String analysis;
protected String keyPoints;
protected List tags;
protected List 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);
}