Skip to content

Commit

Permalink
Final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
triceo committed Oct 7, 2024
1 parent c9df96e commit 8d5bb66
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ai.timefold.solver.core.impl.solver;

import ai.timefold.solver.core.api.score.Score;
import ai.timefold.solver.core.api.score.analysis.ScoreAnalysis;
import ai.timefold.solver.core.api.solver.RecommendedFit;

/**
* @deprecated Prefer {@link DefaultRecommendedAssignment} instead.
*/
@Deprecated(forRemoval = true, since = "1.15.0")
public record DefaultRecommendedFit<Proposition_, Score_ extends Score<Score_>>(long index, Proposition_ proposition,
ScoreAnalysis<Score_> scoreAnalysisDiff)
implements
RecommendedFit<Proposition_, Score_>,
Comparable<DefaultRecommendedFit<Proposition_, Score_>> {

@Override
public int compareTo(DefaultRecommendedFit<Proposition_, Score_> other) {
int scoreComparison = scoreAnalysisDiff.score().compareTo(other.scoreAnalysisDiff.score());
if (scoreComparison != 0) {
return -scoreComparison; // Better scores first.
}
// Otherwise maintain insertion order.
return Long.compareUnsigned(index, other.index); // Unsigned == many more positive values.
}

}

0 comments on commit 8d5bb66

Please sign in to comment.