Skip to content

Commit fd70ed5

Browse files
authored
chore: final check of codebase post refactors (#2148)
1 parent e0ab8bd commit fd70ed5

46 files changed

Lines changed: 292 additions & 378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/main/java/ai/timefold/solver/core/api/domain/solution/ConstraintWeightOverrides.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import ai.timefold.solver.core.api.solver.change.ProblemChange;
1111
import ai.timefold.solver.core.impl.domain.solution.DefaultConstraintWeightOverrides;
1212

13-
import org.jspecify.annotations.NonNull;
13+
import org.jspecify.annotations.NullMarked;
1414
import org.jspecify.annotations.Nullable;
1515

1616
/**
@@ -30,6 +30,7 @@
3030
*
3131
* @param <Score_>
3232
*/
33+
@NullMarked
3334
public interface ConstraintWeightOverrides<Score_ extends Score<Score_>> {
3435

3536
static <Score_ extends Score<Score_>> ConstraintWeightOverrides<Score_> none() {
@@ -46,14 +47,13 @@ static <Score_ extends Score<Score_>> ConstraintWeightOverrides<Score_> of(Map<S
4647
* @return null if the constraint name is not known
4748
*/
4849
@Nullable
49-
Score_ getConstraintWeight(@NonNull String constraintName);
50+
Score_ getConstraintWeight(String constraintName);
5051

5152
/**
5253
* Returns all known constraints.
5354
*
5455
* @return All constraint names for which {@link #getConstraintWeight(String)} returns a non-null value.
5556
*/
56-
@NonNull
5757
Set<String> getKnownConstraintNames();
5858

5959
}

core/src/main/java/ai/timefold/solver/core/api/domain/valuerange/ValueRange.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,10 @@ public interface ValueRange<T> {
2929

3030
/**
3131
* @param value sometimes null
32-
* @return true if the ValueRange contains that value
32+
* @return true if the range contains that value
3333
*/
3434
boolean contains(@Nullable T value);
3535

36-
/**
37-
* Select in random order, but without shuffling the elements.
38-
* Each element might be selected multiple times.
39-
* Scales well because it does not require caching.
40-
*
41-
* @param workingRandom the {@link RandomGenerator} to use when any random number is needed,
42-
* so runs are reproducible.
43-
*/
44-
Iterator<T> createRandomIterator(RandomGenerator workingRandom);
45-
4636
/**
4737
* Used by uniform random selection.
4838
*
@@ -64,4 +54,14 @@ public interface ValueRange<T> {
6454
*/
6555
Iterator<T> createOriginalIterator();
6656

57+
/**
58+
* Select in random order, but without shuffling the elements.
59+
* Each element might be selected multiple times.
60+
* Scales well because it does not require caching.
61+
*
62+
* @param workingRandom the {@link RandomGenerator} to use when any random number is needed,
63+
* so runs are reproducible.
64+
*/
65+
Iterator<T> createRandomIterator(RandomGenerator workingRandom);
66+
6767
}

core/src/main/java/ai/timefold/solver/core/api/domain/variable/InverseRelationShadowVariable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import ai.timefold.solver.core.api.solver.Solver;
1212

1313
/**
14-
* Specifies that a bean property (or a field) is the inverse of a {@link PlanningVariable}, which implies it's a shadow
15-
* variable.
14+
* Specifies that a bean property (or a field) is the inverse of a {@link PlanningVariable} or a {@link PlanningListVariable}
15+
* which implies it's a shadow variable.
1616
* <p>
1717
* It is specified on a getter of a java bean property (or a field) of a {@link PlanningEntity} class.
1818
*/
@@ -22,7 +22,7 @@
2222

2323
/**
2424
* In a bidirectional relationship, the shadow side (= the follower side) uses this property
25-
* (and nothing else) to declare for which {@link PlanningVariable} (= the leader side) it is a shadow.
25+
* (and nothing else) to declare for which variable (= the leader side) it is a shadow.
2626
* <p>
2727
* Both sides of a bidirectional relationship should be consistent: if A points to B, then B must point to A.
2828
* <p>

core/src/main/java/ai/timefold/solver/core/api/domain/variable/NextElementShadowVariable.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
* <p>
2020
* The source variable must be a {@link PlanningListVariable list variable}.
2121
*/
22-
// TODO When a non-disjoint list variable is supported, specify that this annotation is only allowed on disjoint list variables.
2322
@Target({ METHOD, FIELD })
2423
@Retention(RUNTIME)
2524
public @interface NextElementShadowVariable {

core/src/main/java/ai/timefold/solver/core/api/domain/variable/PlanningListVariable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
* </ul>
3939
*
4040
* <p>
41-
* This makes sense for common use cases, for example the Vehicle Routing Problem or Task Assigning. In both cases
42-
* the <em>order</em> in which customers are visited and tasks are being worked on matters. Also, each customer
43-
* must be visited <em>once</em> and each task must be completed by <em>exactly one</em> employee.
41+
* This makes sense for common use cases, for example the Vehicle Routing Problem or Task Assigning.
42+
* In both cases the <em>order</em> in which customers are visited and tasks are being worked on matters.
43+
* Also, each customer must be visited <em>once</em> and each task must be completed by <em>exactly one</em> employee.
4444
*
4545
* @see PlanningPin
4646
* @see PlanningPinToIndex

core/src/main/java/ai/timefold/solver/core/api/domain/variable/PlanningVariableReference.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

core/src/main/java/ai/timefold/solver/core/api/domain/variable/PreviousElementShadowVariable.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
* <p>
2020
* The source variable must be a {@link PlanningListVariable list variable}.
2121
*/
22-
// TODO When a non-disjoint list variable is supported, specify that this annotation is only allowed on disjoint list variables.
2322
@Target({ METHOD, FIELD })
2423
@Retention(RUNTIME)
2524
public @interface PreviousElementShadowVariable {

core/src/main/java/ai/timefold/solver/core/api/domain/variable/ShadowVariable.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@
1111

1212
/**
1313
* Specifies that a bean property (or a field) is a custom shadow variable of 1 or more source variables.
14-
* The source variable may be a genuine {@link PlanningVariable}, {@link PlanningListVariable}, or another shadow variable.
14+
* The source variable may be a genuine {@link PlanningVariable}, {@link PlanningListVariable},
15+
* or another shadow variable.
1516
* <p>
1617
* It is specified on a getter of a java bean property (or a field) of a {@link PlanningEntity} class.
1718
*/
1819
@Target({ METHOD, FIELD })
1920
@Retention(RUNTIME)
2021
public @interface ShadowVariable {
22+
2123
/**
22-
* {@link ai.timefold.solver.core.config.solver.PreviewFeature Preview feature}.
23-
* <p>
24-
* If set, this {@link ShadowVariable} is a supplier variable, and it
25-
* is a name of a method annotated with
26-
* {@link ShadowSources} that computes the value of this
27-
* {@link ShadowVariable}.
24+
* If set, this {@link ShadowVariable} is a supplier variable,
25+
* and it is a name of a method annotated with {@link ShadowSources}
26+
* that computes the value of this {@link ShadowVariable}.
2827
*
2928
* @return the method that computes the value of this {@link ShadowVariable}.
3029
*/

core/src/main/java/ai/timefold/solver/core/api/domain/variable/ShadowVariablesInconsistent.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@
126126
* The solver will fail-fast if it detects a source-induced or fact-induced loop.
127127
* <p>
128128
* Important:
129-
* Do not use a {@link ShadowVariablesInconsistent} property in a method annotated
130-
* with {@link ShadowSources}. {@link ShadowSources} marked methods do not need to check
131-
* {@link ShadowVariablesInconsistent} properties, since they are only called if all
132-
* their dependencies are consistent.
129+
* Do not use a {@link ShadowVariablesInconsistent} property in a method annotated with {@link ShadowSources}.
130+
* {@link ShadowSources} marked methods do not need to check {@link ShadowVariablesInconsistent} properties,
131+
* since they are only called if all their dependencies are consistent.
133132
*/
134133
@Target({ METHOD, FIELD })
135134
@Retention(RUNTIME)

core/src/main/java/ai/timefold/solver/core/api/score/IBendableScore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* @param <Score_> the actual score type to allow addition, subtraction and other arithmetic
1616
*/
1717
@NullMarked
18-
public interface IBendableScore<Score_ extends IBendableScore<Score_>>
19-
extends Score<Score_> {
18+
public sealed interface IBendableScore<Score_ extends IBendableScore<Score_>>
19+
extends Score<Score_> permits BendableBigDecimalScore, BendableScore {
2020

2121
/**
2222
* The sum of this and {@link #softLevelsSize()} equals {@link #levelsSize()}.

0 commit comments

Comments
 (0)