Ejemplo n.º 1
0
 private void processPageList(
     List<Page> listOfPages,
     List<String> listOfUnclasifiedPages,
     Map<String, Integer> unclassifiedPgIndexMap,
     String sBatchFolder) {
   StringBuffer unclassifiedPgPath;
   int index = 0;
   for (Page page : listOfPages) {
     unclassifiedPgPath = new StringBuffer();
     unclassifiedPgPath.append(sBatchFolder);
     unclassifiedPgPath.append(File.separator);
     unclassifiedPgPath.append(page.getComparisonThumbnailFileName());
     listOfUnclasifiedPages.add(unclassifiedPgPath.toString());
     unclassifiedPgIndexMap.put(unclassifiedPgPath.toString(), Integer.valueOf(index));
     index++;
   }
 }
Ejemplo n.º 2
0
  private void updateXmlObject(
      Map<String, CustomValueSortedMap> finalUnclasifiedPageConfidenceMap,
      Map<String, Integer> unclassifiedPgIndexMap,
      List<Page> listOfPages) {
    Set<String> unclasifiedPgsSet = finalUnclasifiedPageConfidenceMap.keySet();
    for (String unclassifiedPage : unclasifiedPgsSet) {
      CustomValueSortedMap listOfConfidenceValues =
          finalUnclasifiedPageConfidenceMap.get(unclassifiedPage);
      Integer indexOfPage = unclassifiedPgIndexMap.get(unclassifiedPage);
      if (indexOfPage == null) {
        continue;
      }
      Page unclassifiedPageNode = listOfPages.get(indexOfPage);
      PageLevelFields pageLevelFields = unclassifiedPageNode.getPageLevelFields();
      if (pageLevelFields == null) {
        pageLevelFields = new PageLevelFields();
        unclassifiedPageNode.setPageLevelFields(pageLevelFields);
      }
      List<DocField> listOfPageLevelFields = pageLevelFields.getPageLevelField();
      DocField pageLevelField = new DocField();
      listOfPageLevelFields.add(pageLevelField);

      if (listOfConfidenceValues.size() >= 1) {
        pageLevelField.setName(IImageMagickCommonConstants.IMAGE_COMPARE_CLASSIFICATION);
        pageLevelField.setValue(listOfConfidenceValues.last().getKey());
        pageLevelField.setConfidence(formatDecimalValue(listOfConfidenceValues.last().getValue()));
      }
      AlternateValues alternativeValues = pageLevelField.getAlternateValues();
      if (alternativeValues == null) {
        alternativeValues = new AlternateValues();
        pageLevelField.setAlternateValues(alternativeValues);
      }
      List<Field> listOfAltValues = alternativeValues.getAlternateValue();
      Iterator<CustomMapClass> itr = listOfConfidenceValues.descendingIterator();
      while (itr.hasNext()) {
        CustomMapClass sampleConfidence = itr.next();
        Field alternateValue = new Field();
        alternateValue.setName(IImageMagickCommonConstants.IMAGE_COMPARE_CLASSIFICATION);
        alternateValue.setValue(sampleConfidence.getKey());
        alternateValue.setConfidence(formatDecimalValue(sampleConfidence.getValue()));
        listOfAltValues.add(alternateValue);
      }
    }
  }