private List<Interval> getIntervalListFromETask() { String[] taskIdList = getTaskIdListFromEPic(); if (null == taskIdList) { return null; } List<Interval> list = new ArrayList<Interval>(); // String startName = "time_start"; // String endName = "time_end"; for (String e : taskIdList) { Map<String, String> cond = new HashMap<String, String>(); cond.put("id", e); List<Map> curList = SQLWapper.selectTask(cond); if (curList.size() == 1) { Map<String, String> resultMap = (Map<String, String>) curList.get(0); SQLHelperSelect helper = new SQLHelperSelect(); helper.value = resultMap; List names = helper.getListString("ncfilename"); taskIdAndNcfilename.put(e, (String) names.get(Convention.modelToint(model))); long start = Long.parseLong(resultMap.get("time_start")); long end = Long.parseLong(resultMap.get("time_end")); Interval curInterval = new Interval(start, end, e); list.add(curInterval); } } Collections.sort(list, cmp); return list; }
public FrameGenerator(String type, String id) { this.id = id; this.type = type; Map<String, String> cond = new HashMap<String, String>(); cond.put("id", id); this.epicContent = SQLWapper.selectPic(cond); if (!"pul_lis".equals(type)) { getStartEndFromEPic(); } taskIdAndNcfilename = new HashMap<String, String>(); frameInfoArray = getFrameInfoList(); }
private FrameInfo[] getFrameInfoList() { if (null != type && type.equals("pul_lis")) { Map<String, String> cond = new HashMap<String, String>(); String id = ((Map<String, String>) epicContent.get(0)).get("task_id"); cond.put("id", id.substring(1, id.length() - 1)); List<Map> curList = SQLWapper.selectNcEmit(cond); if (null != curList && curList.size() == 1) { this.movieStart = 0 - 8 * 60 * 60; this.movieEnd = (FrameGenerator.t - 8) * 60 * 60; Map<String, String> resultMap = (Map<String, String>) curList.get(0); FrameInfo[] res = new FrameInfo[FrameGenerator.t]; for (int i = 0; i < FrameGenerator.t; i++) { String fName = resultMap.get("ncfilename").substring(1, resultMap.get("ncfilename").length() - 1); res[i] = new FrameInfo(fName, i); } return res; } return null; } else { Interval[] intervals = getIntervalArray(); if (null == intervals) { return null; } int n = intervals.length; FrameInfo[] res = new FrameInfo[n]; int i = 0; while (i < n) { if (intervals[i] != null) { String ncfilename = taskIdAndNcfilename.get(intervals[i].getId()); int time = (int) (intervals[i].getEnd() - intervals[i].getOriginalStart()) / 3600 - 1; res[i] = new FrameInfo(ncfilename, time); } i++; } return res; } }