shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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 = "手动选择";
}