示例#1
0
 private String ifParameter(String str) {
   List<String> temp = new ArrayList<String>();
   List<String> list = re.parameterName(str);
   for (int i = 0; i < list.size(); i++) {
     if (param.containsKey(list.get(i))) temp.add(param.get(list.get(i)));
     else temp.add(list.get(i));
   }
   return re.replaceIfParameter(str, temp);
 }
示例#2
0
 public void executeForBlock(String index) throws DefinedException {
   String forName = logicTitle.get(index);
   Log.commentStep(forName);
   List<String> list = re.parameterName(forName);
   String variableName;
   int begin;
   int end;
   try {
     variableName = list.get(0);
     begin = Integer.valueOf(list.get(1));
     if (param.containsKey(list.get(1))) begin = Integer.valueOf(param.get(list.get(1)));
     end = Integer.valueOf(list.get(2));
     if (param.containsKey(list.get(2))) end = Integer.valueOf(param.get(list.get(2)));
   } catch (Exception e) {
     throw new DefinedException(forName + " for title error, miss parameter!");
   }
   for (int i = begin; i <= end; i++) {
     param.put(variableName, String.valueOf(i));
     this.executeLogicBlock(index);
   }
 }
示例#3
0
 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);
 }