Пример #1
0
  private VerificationResult analyseHistory() {
    VerificationResult result = new VerificationResult();
    result.setCriterion(criterion);
    Quantifier quantifier = criterion.getQuantifiers().get(0);
    int counter = 0;
    failHistory = new LinkedList<HistoryItem>();
    for (int i = 0; i < wholeHistory.size(); ++i) {
      if (analyseHistory(wholeHistory.get(i))) {
        ++counter;
      } else {
        failHistory.add(wholeHistory.get(i));
      }
    }
    result.setGood(false);
    switch (quantifier.getType()) {
      case ALL:
        if (counter == wholeHistory.size()) {
          result.setGood(true);
        } else {
          LOGGER.debug("!ALL " + counter + " ; " + wholeHistory.size());
        }
        break;
      case EXIST:
        if (counter > 0) {
          result.setGood(true);
        } else {
          LOGGER.debug("!EXI " + counter + " ; " + wholeHistory.size());
        }
        break;
      case ALONE:
        if (counter == 1) {
          result.setGood(true);
        } else {
          LOGGER.debug("!ALO " + counter + " ; " + wholeHistory.size());
        }
        break;
    }
    // � ��� �� ������ � ������
    // ������� ������ ���������
    // ������� ���� �� ������
    // �����������
    // ���� ������� ������
    if (result.isFail()) {
      Set<HistoryPlainItem> bigWithoutRepeat = new LinkedHashSet<HistoryPlainItem>();
      List<HistoryPlainItem> big = createPlainFailHistory();
      for (HistoryPlainItem hpi : big) {
        while (hpi.getItems().size() > criterion.trickyMethod()) {
          /** ololo we should cut variables */
          hpi.getItems().remove(criterion.trickyMethod());
        }
      }
      for (HistoryPlainItem hpi : big) {
        bigWithoutRepeat.add(hpi);
      }
      big.clear();
      Iterator<HistoryPlainItem> it = bigWithoutRepeat.iterator();
      while (it.hasNext()) {
        big.add(it.next());
      }
      result.setFailHistory(big);
    }

    return result;
  }