Пример #1
0
 private Map<List<Object>, ConstraintMatch> createConstraintMatchMap(
     Collection<ConstraintMatchTotal> constraintMatchTotals) {
   Map<List<Object>, ConstraintMatch> constraintMatchMap =
       new LinkedHashMap<List<Object>, ConstraintMatch>(constraintMatchTotals.size() * 16);
   for (ConstraintMatchTotal constraintMatchTotal : constraintMatchTotals) {
     for (ConstraintMatch constraintMatch : constraintMatchTotal.getConstraintMatchSet()) {
       ConstraintMatch previousConstraintMatch =
           constraintMatchMap.put(
               Arrays.<Object>asList(
                   constraintMatchTotal.getConstraintPackage(),
                   constraintMatchTotal.getConstraintName(),
                   constraintMatchTotal.getScoreLevel(),
                   constraintMatch.getJustificationList(),
                   constraintMatch.getWeightAsNumber()),
               constraintMatch);
       if (previousConstraintMatch != null) {
         throw new IllegalStateException(
             "Score corruption because the constraintMatch ("
                 + constraintMatch
                 + ") was added twice for constraintMatchTotal ("
                 + constraintMatchTotal
                 + ") without removal.");
       }
     }
   }
   return constraintMatchMap;
 }
Пример #2
0
 public String buildConstraintMatchSetText(ConstraintMatchTotal constraintMatchTotal) {
   Set<? extends ConstraintMatch> constraintMatchSet =
       constraintMatchTotal.getConstraintMatchSet();
   StringBuilder text = new StringBuilder(constraintMatchSet.size() * 80);
   for (ConstraintMatch constraintMatch : constraintMatchSet) {
     text.append(constraintMatch.toString()).append("\n");
   }
   return text.toString();
 }