Skip to content

Commit 98fd71a

Browse files
Christopher-Chianellitriceo
authored andcommitted
chore: review comments
1 parent ec76f5f commit 98fd71a

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public abstract class AbstractScoreDirector<Solution_, Score_ extends Score<Scor
9595
private long calculationCount = 0L;
9696
protected @Nullable Solution_ workingSolution;
9797
private int workingInitScore = 0;
98-
private boolean lastVariableUpdateWasSuccessful = true;
98+
private boolean lastVariableUpdateSuccessful = true;
9999

100100
private final boolean isStepAssertOrMore;
101101

@@ -246,7 +246,7 @@ public NeighborhoodNotifier<Solution_> getNeighborhoodNotifier() {
246246

247247
@Override
248248
public final InnerScore<Score_> calculateScore() {
249-
if (lastVariableUpdateWasSuccessful) {
249+
if (lastVariableUpdateSuccessful) {
250250
return innerCalculateScore();
251251
} else {
252252
var invalidScore = InnerScore.invalid(getScoreDefinition().getZeroScore());
@@ -343,12 +343,12 @@ protected void afterSetWorkingSolution() {
343343
// Do nothing
344344
}
345345

346-
public List<Object> getInconsistentEntities() {
346+
public List<Object> computeInconsistentEntities() {
347347
return shadowVariableSupport.getInconsistentEntities();
348348
}
349349

350350
public void unassignInconsistentEntities() {
351-
var inconsistentEntities = getInconsistentEntities();
351+
var inconsistentEntities = computeInconsistentEntities();
352352
if (listVariableStateSupply != null) {
353353
var listVariableDescriptor = listVariableStateSupply.getSourceVariableDescriptor();
354354
var listElementClass = listVariableStateSupply.getSourceVariableDescriptor().getElementType();
@@ -490,11 +490,11 @@ public Solution_ cloneSolution(Solution_ originalSolution) {
490490

491491
@Override
492492
public void updateShadowVariables() {
493-
lastVariableUpdateWasSuccessful = shadowVariableSupport.updateShadowVariables();
493+
lastVariableUpdateSuccessful = shadowVariableSupport.updateShadowVariables();
494494
}
495495

496-
public boolean isLastVariableUpdateWasSuccessful() {
497-
return lastVariableUpdateWasSuccessful;
496+
public boolean isLastVariableUpdateSuccessful() {
497+
return lastVariableUpdateSuccessful;
498498
}
499499

500500
/**
@@ -509,7 +509,7 @@ protected void clearPendingShadowVariableUpdates() {
509509

510510
@Override
511511
public void forceUpdateShadowVariables() {
512-
lastVariableUpdateWasSuccessful = shadowVariableSupport.forceUpdateAllShadowVariables(getWorkingSolution());
512+
lastVariableUpdateSuccessful = shadowVariableSupport.forceUpdateAllShadowVariables(getWorkingSolution());
513513
}
514514

515515
protected void setCalculatedScore(Score_ score) {

core/src/main/java/ai/timefold/solver/core/impl/solver/DefaultSolutionManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public ScoreDirectorFactory<Solution_, Score_> getScoreDirectorFactory() {
5353
public Score_ update(Solution_ solution, SolutionUpdatePolicy solutionUpdatePolicy) {
5454
if (solutionUpdatePolicy == SolutionUpdatePolicy.NO_UPDATE) {
5555
throw new IllegalArgumentException(
56-
"Can not call %s.update() with this solutionUpdatePolicy (%s)."
56+
"Cannot call %s.update() with this solutionUpdatePolicy (%s), since it would do nothing."
5757
.formatted(this.getClass().getSimpleName(), solutionUpdatePolicy));
5858
}
5959
return callScoreDirector("Solution update", solution, solutionUpdatePolicy,
@@ -86,11 +86,11 @@ private <Result_> Result_ callScoreDirector(String feature, Solution_ solution,
8686
if (solutionUpdatePolicy.isScoreUpdateEnabled()) {
8787
var score = scoreDirector.calculateScore();
8888
if (score.isInvalid()) {
89-
var inconsistentEntities = scoreDirector.getInconsistentEntities();
89+
var inconsistentEntities = scoreDirector.computeInconsistentEntities();
9090
throw new InconsistentSolutionException(feature, nonNullSolution, inconsistentEntities);
9191
}
92-
} else if (!scoreDirector.isLastVariableUpdateWasSuccessful()) {
93-
var inconsistentEntities = scoreDirector.getInconsistentEntities();
92+
} else if (!scoreDirector.isLastVariableUpdateSuccessful()) {
93+
var inconsistentEntities = scoreDirector.computeInconsistentEntities();
9494
throw new InconsistentSolutionException(feature, nonNullSolution, inconsistentEntities);
9595
}
9696
return function.apply(scoreDirector);
@@ -121,7 +121,7 @@ public ScoreAnalysis<Score_> analyze(Solution_ solution, ScoreAnalysisFetchPolic
121121
var enterpriseService =
122122
TimefoldSolverEnterpriseService.loadOrFail(TimefoldSolverEnterpriseService.Feature.SCORE_ANALYSIS);
123123
var currentScore = (Score_) scoreDirectorFactory.getSolutionDescriptor().getScore(solution);
124-
var analysis = callScoreDirector("Solution analysis", solution, solutionUpdatePolicy,
124+
var analysis = callScoreDirector("Score analysis", solution, solutionUpdatePolicy,
125125
scoreDirector -> enterpriseService.analyze(scoreDirector.calculateScore(),
126126
scoreDirector.getConstraintMatchTotalMap(), fetchPolicy),
127127
ConstraintMatchPolicy.match(fetchPolicy), false);

0 commit comments

Comments
 (0)