Skip to content

Commit cd4ddd8

Browse files
chore: merge fixes
1 parent aae6c7f commit cd4ddd8

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package ai.timefold.solver.core.api.domain.variable;
22

3+
import java.util.Collection;
34
import java.util.List;
45

56
import org.jspecify.annotations.NullMarked;
67

78
@NullMarked
89
public class InconsistentSolutionException extends RuntimeException {
910
private final Object solution;
10-
private final List<Object> involvedEntityList;
11+
private final Collection<Object> involvedEntityCollection;
1112

12-
public InconsistentSolutionException(String feature, Object solution, List<Object> involvedEntityList) {
13+
public InconsistentSolutionException(String feature, Object solution, Collection<Object> involvedEntityCollection) {
1314
super("The solution (%s) is inconsistent. %s requires a consistent solution.".formatted(solution, feature));
1415
this.solution = solution;
15-
this.involvedEntityList = involvedEntityList;
16+
this.involvedEntityCollection = involvedEntityCollection;
1617
}
1718

1819
@SuppressWarnings("unchecked")
@@ -21,7 +22,7 @@ public <T> T getSolution() {
2122
}
2223

2324
@SuppressWarnings("unchecked")
24-
public <T> List<T> getInvolvedEntityList() {
25-
return (List<T>) involvedEntityList;
25+
public <T> List<T> getInvolvedEntityCollection() {
26+
return (List<T>) involvedEntityCollection;
2627
}
2728
}

core/src/main/java/ai/timefold/solver/core/impl/score/director/AbstractScoreDirector.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static java.util.Objects.requireNonNull;
44

5+
import java.util.Collection;
56
import java.util.HashMap;
67
import java.util.HashSet;
78
import java.util.IdentityHashMap;
@@ -343,7 +344,7 @@ protected void afterSetWorkingSolution() {
343344
// Do nothing
344345
}
345346

346-
public List<Object> computeInconsistentEntities() {
347+
public Collection<Object> computeInconsistentEntities() {
347348
return shadowVariableSupport.getInconsistentEntities();
348349
}
349350

core/src/test/java/ai/timefold/solver/core/api/solver/SolutionManagerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.time.Duration;
88
import java.util.Arrays;
99
import java.util.List;
10+
import java.util.Set;
1011
import java.util.function.Function;
1112

1213
import ai.timefold.solver.core.api.domain.variable.InconsistentSolutionException;
@@ -142,7 +143,7 @@ void updateInconsistent(SolutionManagerSource solutionManagerSource) {
142143
.hasMessageContainingAll("The solution (",
143144
"is inconsistent", "Solution update", "requires a consistent solution")
144145
.hasFieldOrPropertyWithValue("solution", inconsistentSolution)
145-
.hasFieldOrPropertyWithValue("involvedEntityList", List.of(valueA1, valueA2));
146+
.hasFieldOrPropertyWithValue("involvedEntityCollection", Set.of(valueA1, valueA2));
146147
}
147148

148149
private void assertShadowedListValueAllNull(SoftAssertions softly, TestdataListValueWithShadowHistory current) {
@@ -204,7 +205,7 @@ void updateOnlyShadowVariablesInconsistent(SolutionManagerSource solutionManager
204205
.hasMessageContainingAll("The solution (",
205206
"is inconsistent", "Solution update", "requires a consistent solution")
206207
.hasFieldOrPropertyWithValue("solution", inconsistentSolution)
207-
.hasFieldOrPropertyWithValue("involvedEntityList", List.of(valueA1, valueA2));
208+
.hasFieldOrPropertyWithValue("involvedEntityCollection", Set.of(valueA1, valueA2));
208209
}
209210

210211
@ParameterizedTest

0 commit comments

Comments
 (0)