private boolean logicConnector(String str, List<Boolean> temp) throws DefinedException { boolean result = false; String conn = re.getLogicConnector(str); if (conn != null) { try { if (conn.equals(Keyword.getKeyword("and"))) result = temp.get(0) && temp.get(1); if (conn.equals(Keyword.getKeyword("or"))) result = temp.get(0) || temp.get(1); } catch (Exception e) { throw new DefinedException("if title error, miss condition!"); } } else result = temp.get(0); return result; }
private boolean ifCondition(String str) throws DefinedException { List<String> conList = re.getIfCondition(str); List<Boolean> temp = new ArrayList<Boolean>(); List<String> conditions = new ArrayList<String>(); for (String con : conList) { String condition = this.ifParameter(con); conditions.add(condition); List<String> pName = re.parameterName(condition); String determine = re.getDetermine(condition); boolean b; try { b = pName.get(0).equals(pName.get(1)); } catch (Exception e) { throw new DefinedException("if title error, miss condition parameter!"); } if (determine.equals(Keyword.getKeyword("equals"))) temp.add(b); if (determine.equals(Keyword.getKeyword("notEquals"))) temp.add(!b); } str = re.replaceIfCondition(str, conditions); Log.commentStep(str); if (temp.size() == 0) throw new DefinedException(str + " if title error, miss condition parameter!"); return this.logicConnector(str, temp); }