Skip to content

Commit

Permalink
Fix quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
triceo committed Nov 7, 2024
1 parent 265c836 commit 4798189
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ public enum ConstraintMatchPolicy {

public static ConstraintMatchPolicy match(ScoreAnalysisFetchPolicy scoreAnalysisFetchPolicy) {
return switch (scoreAnalysisFetchPolicy) {
case FETCH_MATCH_COUNT, FETCH_SHALLOW -> ENABLED_WITHOUT_JUSTIFICATIONS;
case FETCH_ALL -> ENABLED;
case FETCH_MATCH_COUNT -> ENABLED_WITHOUT_JUSTIFICATIONS;
case FETCH_SHALLOW -> DISABLED;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ public Score_ calculateScore() {

@Override
public Map<String, ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap() {
if (workingSolution == null) {
if (!constraintMatchPolicy.isEnabled()) {
throw new IllegalStateException("When constraint matching is disabled, this method should not be called.");
} else if (workingSolution == null) {
throw new IllegalStateException(
"The method setWorkingSolution() must be called before the method getConstraintMatchTotalMap().");
} else if (!constraintMatchPolicy.isEnabled()) {
throw new IllegalStateException("When constraint matching is disabled, this method should not be called.");
}
return session.getConstraintMatchTotalMap();
}

@Override
public Map<Object, Indictment<Score_>> getIndictmentMap() {
if (workingSolution == null) {
throw new IllegalStateException(
"The method setWorkingSolution() must be called before the method getIndictmentMap().");
} else if (!constraintMatchPolicy.isJustificationEnabled()) {
if (!constraintMatchPolicy.isJustificationEnabled()) {
throw new IllegalStateException(
"When constraint matching with justifications is disabled, this method should not be called.");
} else if (workingSolution == null) {
throw new IllegalStateException(
"The method setWorkingSolution() must be called before the method getIndictmentMap().");
}
return session.getIndictmentMap();
}
Expand Down

0 comments on commit 4798189

Please sign in to comment.