|
|
@@ -1,53 +0,0 @@
|
|
|
-package nju.seec.helper.util.enums;
|
|
|
-
|
|
|
-import com.google.common.collect.ImmutableMap;
|
|
|
-import com.google.common.collect.ImmutableSet;
|
|
|
-import lombok.NonNull;
|
|
|
-import lombok.val;
|
|
|
-
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author xst
|
|
|
- * <p>
|
|
|
- * updated by cst
|
|
|
- */
|
|
|
-public enum QuizState {
|
|
|
- NOT_STARTED("未开始"), ONGOING("正在进行"), CLOSED("已结束");
|
|
|
- private String name;
|
|
|
-
|
|
|
- QuizState(String name) {
|
|
|
- this.name = name;
|
|
|
- }
|
|
|
-
|
|
|
- public String getName() {
|
|
|
- return name;
|
|
|
- }
|
|
|
-
|
|
|
- public void setName(String name) {
|
|
|
- this.name = name;
|
|
|
- }
|
|
|
-
|
|
|
- private static final Map<SlideState, Map<QuizState, Set<QuizType>>> MAP = ImmutableMap.of(
|
|
|
- SlideState.DRAFT, ImmutableMap.of(NOT_STARTED, ImmutableSet.of(QuizType.BEFORE_CLASS, QuizType.IN_CLASS, QuizType.AFTER_CLASS)),
|
|
|
- SlideState.BEFORE_CLASS, ImmutableMap.of(NOT_STARTED, ImmutableSet.of(QuizType.IN_CLASS, QuizType.AFTER_CLASS),
|
|
|
- ONGOING, ImmutableSet.of(QuizType.BEFORE_CLASS)),
|
|
|
- SlideState.IN_CLASS, ImmutableMap.of(NOT_STARTED, ImmutableSet.of(QuizType.AFTER_CLASS),
|
|
|
- ONGOING, ImmutableSet.of(QuizType.IN_CLASS),
|
|
|
- CLOSED, ImmutableSet.of(QuizType.BEFORE_CLASS)),
|
|
|
- SlideState.AFTER_CLASS, ImmutableMap.of(ONGOING, ImmutableSet.of(QuizType.AFTER_CLASS),
|
|
|
- CLOSED, ImmutableSet.of(QuizType.BEFORE_CLASS, QuizType.IN_CLASS)),
|
|
|
- SlideState.FINISH, ImmutableMap.of(CLOSED, ImmutableSet.of(QuizType.BEFORE_CLASS, QuizType.IN_CLASS, QuizType.AFTER_CLASS))
|
|
|
- );
|
|
|
-
|
|
|
- public static QuizState getQuizStateBySlideStateAndQuizType(@NonNull SlideState slideState, @NonNull QuizType quizType) {
|
|
|
- Map<QuizState, Set<QuizType>> map = MAP.get(slideState);
|
|
|
- for (val entry : map.entrySet()) {
|
|
|
- if (entry.getValue().contains(quizType)) {
|
|
|
- return entry.getKey();
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-}
|