-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
core/src/main/java/ai/timefold/solver/core/impl/solver/DefaultRecommendedFit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
} | ||
|
||
} |