Esempio n. 1
0
 // /olololo
 @SuppressWarnings("unchecked")
 private void verify(HistoryItem parentHistoryItem, int currentIndex) {
   assert currentIndex > 0 : "Bad index";
   if (currentIndex < criterion.getQuantifiers().size()) {
     Quantifier quantifier = criterion.getQuantifiers().get(currentIndex);
     List<Object> set = null;
     try {
       set = quantifier.getRightPart().getSet(parentHistoryItem.getPlainHistory());
     } catch (MappingException e) {
       e.printStackTrace();
     }
     assert set != null;
     if (set.isEmpty()) {
       // parentHistoryItem.setSuccess(false);
       HistoryItem historyItem = new HistoryItem();
       historyItem.getVariableValue().variable = quantifier.getBoundVariable();
       historyItem.getVariableValue().value = null;
       historyItem.setParent(parentHistoryItem);
       parentHistoryItem.getChildren().add(historyItem);
       verify(historyItem, currentIndex + 1);
     }
     for (int i = 0; i < set.size(); ++i) {
       Object o = set.get(i);
       HistoryItem historyItem = new HistoryItem();
       historyItem.getVariableValue().variable = quantifier.getBoundVariable();
       historyItem.getVariableValue().value = o;
       historyItem.setParent(parentHistoryItem);
       parentHistoryItem.getChildren().add(historyItem);
       verify(historyItem, currentIndex + 1);
     }
   } else {
     List<VariableValue> currentVariables = parentHistoryItem.getPlainHistory();
     boolean result = criterion.getFormula().predict(currentVariables);
     parentHistoryItem.setSuccess(result);
   }
 }