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
| package com.ycl.jxkg.enums;
|
| import java.util.HashMap;
| import java.util.Map;
|
| public enum QuestionTypeEnum {
|
| SingleChoice(1, "单选题"),
| MultipleChoice(2, "多选题"),
| TrueFalse(3, "判断题"),
| GapFilling(4, "填空题"),
| ShortAnswer(5, "简答题"),
| Calculation(6,"计算题");
|
| Integer code;
| String name;
|
| QuestionTypeEnum(Integer code, String name) {
| this.code = code;
| this.name = name;
| }
|
|
| private static Map<Integer, QuestionTypeEnum> keyMap = new HashMap<>();
|
| static {
| for (QuestionTypeEnum item : QuestionTypeEnum.values()) {
| keyMap.put(item.getCode(), item);
| }
| }
|
| public static QuestionTypeEnum fromCode(Integer code) {
| return keyMap.get(code);
| }
|
| public static boolean needSaveTextContent(Integer code) {
| QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(code);
| switch (questionTypeEnum) {
| case GapFilling:
| case ShortAnswer:
| return true;
| default:
| return false;
| }
| }
|
| public Integer getCode() {
| return code;
| }
|
| public String getName() {
| return name;
| }
|
|
|
| }
|
|