Skip to content

Commit

Permalink
chore: address Sonar C-rating
Browse files Browse the repository at this point in the history
  • Loading branch information
triceo authored and rsynek committed Dec 7, 2023
1 parent 86d58e6 commit 60d8647
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,21 @@ public List<RecommendedFit<Out_, Score_>> apply(InnerScoreDirector<Solution_, Sc
entityPlacer.stepStarted(stepScope);

try (scoreDirector) {
for (var placement : entityPlacer) {
var recommendedFitList = new ArrayList<RecommendedFit<Out_, Score_>>();
var moveIndex = 0L;
for (var move : placement) {
recommendedFitList.add(execute(scoreDirector, move, moveIndex, clonedElement, valueResultFunction));
moveIndex++;
}
recommendedFitList.sort(null);
return recommendedFitList;
var placementIterator = entityPlacer.iterator();
if (!placementIterator.hasNext()) {
throw new IllegalStateException("""
Impossible state: entity placer (%s) has no placements.
""".formatted(entityPlacer));
}
throw new IllegalStateException("""
Impossible state: entity placer (%s) has no placements.
""".formatted(entityPlacer));
var placement = placementIterator.next();
var recommendedFitList = new ArrayList<RecommendedFit<Out_, Score_>>();
var moveIndex = 0L;
for (var move : placement) {
recommendedFitList.add(execute(scoreDirector, move, moveIndex, clonedElement, valueResultFunction));
moveIndex++;
}
recommendedFitList.sort(null);
return recommendedFitList;
} finally {
entityPlacer.stepEnded(stepScope);
entityPlacer.phaseEnded(phaseScope);
Expand Down

0 comments on commit 60d8647

Please sign in to comment.