endian11
2021-01-19 b2fe9c4f073523284c671bf8895a8412cd269518
app/src/main/java/safeluck/drive/evaluation/bean/SimulateNightBean.java
@@ -1,14 +1,12 @@
package safeluck.drive.evaluation.bean;
import java.util.ArrayList;
import java.util.List;
import safeluck.drive.evaluation.util.FileUtil;
public class SimulateNightBean {
    /**
     * exam : 0
     * question : [{"item":1,"tts":"打开车灯"},{"item":2,"tts":"通过人行道"}]
     * question : [{"item":100,"process":[],"solution":[-1],"tts":"下面将进行模拟夜间行驶场景灯光使用的考试,请按语音指令在5秒内做出相应的灯光操作"},{"item":1,"process":[3],"solution":[1],"tts":"请打开前照灯"},{"item":2,"process":[3],"solution":[1],"tts":"夜间在没有路灯,照明不良条件下行驶"},{"item":7,"process":[3],"solution":[1],"tts":"夜间在道路上发生故障,妨碍交通又难以移动"},{"item":10,"process":[3],"solution":[1],"tts":"路边临时停车"},{"item":9,"process":[3],"solution":[1],"tts":"夜间通过没有交通信号灯控制的路口"},{"item":101,"process":[],"solution":[-1],"tts":"模拟夜间考试完成请关闭所有灯光,请起步继续完成考试"}]
     */
    private int exam;
@@ -32,18 +30,82 @@
    public static class QuestionBean {
        /**
         * item : 1
         * tts : 打开车灯
         * item : 100
         * process : []
         * solution : [-1]
         * tts : 下面将进行模拟夜间行驶场景灯光使用的考试,请按语音指令在5秒内做出相应的灯光操作
         */
        private int item;
        private String tts;
        private List<Integer> process;
        private List<Integer> solution;
        public QuestionBean(int i, String s) {
            this.item =i;
                        this.item =i;
            this.tts = s;
            if (i>=100){
            }else{
                if (process == null){
                    this.process = new ArrayList<>();
                }
                this.process.add(-1);
                if (solution == null){
                    this.solution = new ArrayList<>();
                }
                this.solution.add(-1);
            }
        }
        public void parseSolutionAndProcess(String content){
            solution.clear();
            process.clear();
            if (content.contains("+")){
                String regx = "\\+";
                    String[] strs = content.split(regx);
                for (int i = 0; i < strs.length; i++) {
                    if (strs[i].contains("大灯")){
                        //1近光灯
                        solution.add(1);
                    }else if (strs[i].contains("小灯")){
                        //3示廓灯
                        solution.add(3);
                    }else if (strs[i].contains("警示灯")){
                        //7危险警示灯
                        solution.add(7);
                    }else if (strs[i].contains("雾灯")){
                        //4雾灯
                        solution.add(4);
                    }else if (strs[i].contains("左转向")){
                        //5左转信号
                        solution.add(5);
                    }else if (strs[i].contains("右转向")){
                        //6右转信号
                        solution.add(6);
                    }
                }
            }else if (content.contains("变换")){
                process.add(8);
                solution.add(1);
            }else if (content.equalsIgnoreCase("开启远光灯")){
                solution.add(2);
            }else if (content.equalsIgnoreCase("开启近光灯")){
                solution.add(1);
            }else if (content.contains("远、近光灯")){
                solution.add(1);
                solution.add(2);
            }else if (content.contains("注意是近光")){
                solution.add(1);
            }else if (content.equalsIgnoreCase("开启危险警示灯")){
                solution.add(7);
            }else if (content.equalsIgnoreCase("先开左转向灯,后变换远近光灯")){
                process.add(5);
                solution.add(8);
            }
        }
        public int getItem() {
            return item;
        }
@@ -60,20 +122,92 @@
            this.tts = tts;
        }
        @Override
        public String toString() {
            return "QuestionBean{" +
                    "item=" + item +
                    ", tts='" + tts + '\'' +
                    '}';
        public List<Integer> getProcess() {
            return process;
        }
        public void setProcess(List<Integer> process) {
            this.process = process;
        }
        public List<Integer> getSolution() {
            return solution;
        }
        public void setSolution(List<Integer> solution) {
            this.solution = solution;
        }
    }
    @Override
    public String toString() {
        return "SimulateNightBean{" +
                "exam=" + exam +
                ", question=" + FileUtil.ListToString(question) +
                '}';
    }
//    /**
//     * exam : 0
//     * question : [{"item":1,"tts":"打开车灯"},{"item":2,"tts":"通过人行道"}]
//     */
//
//    private int exam;
//    private List<QuestionBean> question;
//
//    public int getExam() {
//        return exam;
//    }
//
//    public void setExam(int exam) {
//        this.exam = exam;
//    }
//
//    public List<QuestionBean> getQuestion() {
//        return question;
//    }
//
//    public void setQuestion(List<QuestionBean> question) {
//        this.question = question;
//    }
//
//    public static class QuestionBean {
//        /**
//         * item : 1
//         * tts : 打开车灯
//         */
//
//        private int item;
//        private String tts;
//
//        public QuestionBean(int i, String s) {
//            this.item =i;
//            this.tts = s;
//        }
//
//        public int getItem() {
//            return item;
//        }
//
//        public void setItem(int item) {
//            this.item = item;
//        }
//
//        public String getTts() {
//            return tts;
//        }
//
//        public void setTts(String tts) {
//            this.tts = tts;
//        }
//
//        @Override
//        public String toString() {
//            return "QuestionBean{" +
//                    "item=" + item +
//                    ", tts='" + tts + '\'' +
//                    '}';
//        }
//    }
//
//    @Override
//    public String toString() {
//        return "SimulateNightBean{" +
//                "exam=" + exam +
//                ", question=" + FileUtil.ListToString(question) +
//                '}';
//    }
}