anchor.diff:  [[explainingTheScore]]
   == Explaining the Score: Using Score Calculation Outside the `Solver`
   
  -If other parts of your application, for example your webUI, need to calculate the score of a solution
  -or they need to point out what's causing constraints to be broken/fulfilled,
  +If other parts of your application, for example your webUI, need to calculate the score of a solution,
   reuse the `ScoreDirectorFactory` of the `Solver` to build a separate `ScoreDirector` for that webUI:
   
   [source,java,options="nowrap"]
  
positive.code: Assert its correctness by using <<invalidScoreDetection,an ``EasyScoreCalculator`` to do the assertions triggered by the ``environmentMode``>>.
  ====
  
  ==== `ConstraintMatchAwareIncrementalScoreCalculator`
  
  Optionally, also implement the `ConstraintMatchAwareIncrementalScoreCalculator` interface to:
  
negative.code: guiScoreDirector.dispose();
  ----
  
  [IMPORTANT]
  ====
  Don't forget to call `ScoreDirector.dispose()` when the `ScoreDirector` becomes useless,
  especially with <<droolsScoreCalculation,Drools score calculation>>, to avoid a memory leak.
  ====
  
  Then use it when you need to calculate the `Score` of a ``Solution``:
  
  [source,java,options="nowrap"]
  ----
  guiScoreDirector.setWorkingSolution(cloudBalance);
  Score score = guiScoreDirector.calculateScore();
  ----
  
  
  [[constraintMatchTotal]]
  === Constraint Match Total: Break down the Score by Constraint
  
  To break down the score per constraint (so per score rule with Drools score calculation),
  get the ``ConstraintMatchTotal``s from the ``ScoreDirector``:
  
  [source,java,options="nowrap"]
  ----
  for (ConstraintMatchTotal constraintMatchTotal : guiScoreDirector.getConstraintMatchTotals()) {
      String constraintName = constraintMatchTotal.getConstraintName();
      // The score impact of that constraint
      Score scoreTotal = constraintMatchTotal.getScoreTotal();
  
      for (ConstraintMatch constraintMatch : constraintMatchTotal.getConstraintMatchSet()) {
          List<Object> justificationList = constraintMatch.getJustificationList();
          Score score = constraintMatch.getScore();
  