From b2fe9c4f073523284c671bf8895a8412cd269518 Mon Sep 17 00:00:00 2001 From: endian11 <Dana_Lee1016@126.com> Date: 星期二, 19 一月 2021 15:06:34 +0800 Subject: [PATCH] 完成灯光发送 --- app/src/main/java/safeluck/drive/evaluation/bean/SimulateNightBean.java | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 154 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/safeluck/drive/evaluation/bean/SimulateNightBean.java b/app/src/main/java/safeluck/drive/evaluation/bean/SimulateNightBean.java index a688ef4..abfa37b 100644 --- a/app/src/main/java/safeluck/drive/evaluation/bean/SimulateNightBean.java +++ b/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) + +// '}'; +// } + } -- Gitblit v1.8.0