Пример #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();
 }
 private void localSearchStepEnded(LocalSearchStepScope stepScope) {
   if (constraintMatchEnabled) {
     long timeMillisSpent = stepScope.getPhaseScope().calculateSolverTimeMillisSpent();
     for (ConstraintMatchTotal constraintMatchTotal :
         stepScope.getScoreDirector().getConstraintMatchTotals()) {
       pointList.add(
           new ConstraintMatchTotalStepScoreStatisticPoint(
               timeMillisSpent,
               constraintMatchTotal.getConstraintPackage(),
               constraintMatchTotal.getConstraintName(),
               constraintMatchTotal.getScoreLevel(),
               constraintMatchTotal.getConstraintMatchCount(),
               constraintMatchTotal.getWeightTotalAsNumber().doubleValue()));
     }
   }
 }
Пример #4
0
 @Override
 public Object getValueAt(int rowIndex, int columnIndex) {
   ConstraintMatchTotal constraintMatchTotal = constraintMatchTotalList.get(rowIndex);
   switch (columnIndex) {
     case 0:
       return constraintMatchTotal.getConstraintPackage();
     case 1:
       return constraintMatchTotal.getConstraintName();
     case 2:
       return constraintMatchTotal.getScoreLevel();
     case 3:
       return constraintMatchTotal.getConstraintMatchCount();
     case 4:
       return constraintMatchTotal.getWeightTotalAsNumber();
     default:
       throw new IllegalStateException("The columnIndex (" + columnIndex + ") is invalid.");
   }
 }