package com.walker.etaa;
|
|
/**
|
* 试卷抽取策略。
|
* @author 时克英
|
* @date 2023-04-25
|
*/
|
public enum PaperPolicy {
|
|
/**
|
* 完全随机抽取,仅设置总题量
|
*/
|
Random {
|
public String getIndex(){
|
return INDEX_RANDOM;
|
}
|
public String getName(){
|
return NAME_RANDOM;
|
}
|
},
|
|
/**
|
* 指定试题类型,也是随机抽取,不同试题类型需要设置数量。
|
*/
|
AssignType {
|
public String getIndex(){
|
return INDEX_ASSIGN_TYPE;
|
}
|
public String getName(){
|
return NAME_ASSIGN_TYPE;
|
}
|
},
|
|
/**
|
* 用户手动控制,手动选择试题集合。
|
*/
|
Manual {
|
public String getIndex(){
|
return INDEX_MANUAL;
|
}
|
public String getName(){
|
return NAME_MANUAL;
|
}
|
};
|
|
public String getIndex(){
|
throw new AbstractMethodError();
|
}
|
public String getName(){
|
throw new AbstractMethodError();
|
}
|
|
public static final PaperPolicy getType(String index){
|
if(index.equalsIgnoreCase(INDEX_RANDOM)){
|
return Random;
|
} else if (index.equalsIgnoreCase(INDEX_ASSIGN_TYPE)) {
|
return AssignType;
|
} else if (index.equalsIgnoreCase(INDEX_MANUAL)) {
|
return Manual;
|
} else {
|
throw new UnsupportedOperationException("未支持的组卷策略:" + index);
|
}
|
}
|
|
public static final String INDEX_RANDOM = "random";
|
public static final String INDEX_ASSIGN_TYPE = "assign_type";
|
public static final String INDEX_MANUAL = "manual";
|
|
public static final String NAME_RANDOM = "完全随机";
|
public static final String NAME_ASSIGN_TYPE = "指定类型";
|
public static final String NAME_MANUAL = "手动选择";
|
}
|