Skip to content

Commit 9c76a25

Browse files
committed
chore: renaming
1 parent 7baac22 commit 9c76a25

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/value/ValueSelectorConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ public static <Solution_> boolean hasSorter(@NonNull ValueSorterManner valueSort
349349
case DECREASING_STRENGTH:
350350
return true;
351351
case INCREASING_STRENGTH_IF_AVAILABLE:
352-
return variableDescriptor.getIncreasingStrengthSorter() != null;
352+
return variableDescriptor.getAscendingSorter() != null;
353353
case DECREASING_STRENGTH_IF_AVAILABLE:
354-
return variableDescriptor.getDecreasingStrengthSorter() != null;
354+
return variableDescriptor.getDescendingSorter() != null;
355355
default:
356356
throw new IllegalStateException("The sorterManner ("
357357
+ valueSorterManner + ") is not implemented.");
@@ -366,11 +366,11 @@ public static <Solution_> boolean hasSorter(@NonNull ValueSorterManner valueSort
366366
throw new IllegalStateException("Impossible state: hasSorter() should have returned null.");
367367
case INCREASING_STRENGTH:
368368
case INCREASING_STRENGTH_IF_AVAILABLE:
369-
sorter = variableDescriptor.getIncreasingStrengthSorter();
369+
sorter = variableDescriptor.getAscendingSorter();
370370
break;
371371
case DECREASING_STRENGTH:
372372
case DECREASING_STRENGTH_IF_AVAILABLE:
373-
sorter = variableDescriptor.getDecreasingStrengthSorter();
373+
sorter = variableDescriptor.getDescendingSorter();
374374
break;
375375
default:
376376
throw new IllegalStateException("The sorterManner ("

core/src/main/java/ai/timefold/solver/core/impl/domain/entity/descriptor/EntityDescriptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
import ai.timefold.solver.core.impl.domain.variable.nextprev.NextElementShadowVariableDescriptor;
6565
import ai.timefold.solver.core.impl.domain.variable.nextprev.PreviousElementShadowVariableDescriptor;
6666
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter;
67-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFactorySorter;
67+
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.FactorySelectionSorter;
6868
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorter;
6969
import ai.timefold.solver.core.impl.move.director.MoveDirector;
7070
import ai.timefold.solver.core.impl.neighborhood.maybeapi.stream.enumerating.function.UniEnumeratingFilter;
@@ -290,7 +290,7 @@ private void processDifficulty(PlanningEntity entityAnnotation) {
290290
if (difficultyWeightFactoryClass != null) {
291291
var difficultyWeightFactory = ConfigUtils.newInstance(this::toString,
292292
"difficultyWeightFactoryClass", difficultyWeightFactoryClass);
293-
decreasingDifficultySorter = new SelectionFactorySorter<>(
293+
decreasingDifficultySorter = new FactorySelectionSorter<>(
294294
difficultyWeightFactory, SelectionSorterOrder.DESCENDING);
295295
}
296296
}

core/src/main/java/ai/timefold/solver/core/impl/domain/variable/descriptor/GenuineVariableDescriptor.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import ai.timefold.solver.core.impl.domain.valuerange.descriptor.FromSolutionPropertyValueRangeDescriptor;
2222
import ai.timefold.solver.core.impl.domain.valuerange.descriptor.ValueRangeDescriptor;
2323
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter;
24-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFactorySorter;
24+
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.FactorySelectionSorter;
2525
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorter;
2626

2727
/**
@@ -30,8 +30,8 @@
3030
public abstract class GenuineVariableDescriptor<Solution_> extends VariableDescriptor<Solution_> {
3131

3232
private ValueRangeDescriptor<Solution_> valueRangeDescriptor;
33-
private SelectionSorter<Solution_, Object> increasingStrengthSorter;
34-
private SelectionSorter<Solution_, Object> decreasingStrengthSorter;
33+
private SelectionSorter<Solution_, Object> ascendingSorter;
34+
private SelectionSorter<Solution_, Object> descendingSorter;
3535

3636
// ************************************************************************
3737
// Constructors and simple getters/setters
@@ -173,17 +173,17 @@ protected void processSorting(String comparatorPropertyName, Class<? extends Com
173173
}
174174
if (comparatorClass != null) {
175175
Comparator<Object> strengthComparator = newInstance(this::toString, comparatorPropertyName, comparatorClass);
176-
increasingStrengthSorter = new ComparatorSelectionSorter<>(strengthComparator,
176+
ascendingSorter = new ComparatorSelectionSorter<>(strengthComparator,
177177
SelectionSorterOrder.ASCENDING);
178-
decreasingStrengthSorter = new ComparatorSelectionSorter<>(strengthComparator,
178+
descendingSorter = new ComparatorSelectionSorter<>(strengthComparator,
179179
SelectionSorterOrder.DESCENDING);
180180
}
181181
if (comparatorFactoryClass != null) {
182-
SorterFactory<Solution_, Object> strengthWeightFactory =
182+
SorterFactory<Solution_, Object> comparatorFactory =
183183
newInstance(this::toString, comparatorFactoryPropertyName, comparatorFactoryClass);
184-
increasingStrengthSorter = new SelectionFactorySorter<>(strengthWeightFactory,
184+
ascendingSorter = new FactorySelectionSorter<>(comparatorFactory,
185185
SelectionSorterOrder.ASCENDING);
186-
decreasingStrengthSorter = new SelectionFactorySorter<>(strengthWeightFactory,
186+
descendingSorter = new FactorySelectionSorter<>(comparatorFactory,
187187
SelectionSorterOrder.DESCENDING);
188188
}
189189
}
@@ -238,12 +238,12 @@ public boolean isReinitializable(Object entity) {
238238
return value == null;
239239
}
240240

241-
public SelectionSorter<Solution_, Object> getIncreasingStrengthSorter() {
242-
return increasingStrengthSorter;
241+
public SelectionSorter<Solution_, Object> getAscendingSorter() {
242+
return ascendingSorter;
243243
}
244244

245-
public SelectionSorter<Solution_, Object> getDecreasingStrengthSorter() {
246-
return decreasingStrengthSorter;
245+
public SelectionSorter<Solution_, Object> getDescendingSorter() {
246+
return descendingSorter;
247247
}
248248

249249
@Override
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
* @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation
2222
* @param <T> the selection type
2323
*/
24-
public final class SelectionFactorySorter<Solution_, T> implements SelectionSorter<Solution_, T> {
24+
public final class FactorySelectionSorter<Solution_, T> implements SelectionSorter<Solution_, T> {
2525

2626
private final SorterFactory<Solution_, T> selectionSorterFactory;
2727
private final Comparator<Comparable> comparator;
2828

29-
public SelectionFactorySorter(SorterFactory<Solution_, T> selectionSorterFactory,
30-
SelectionSorterOrder selectionSorterOrder) {
29+
public FactorySelectionSorter(SorterFactory<Solution_, T> selectionSorterFactory,
30+
SelectionSorterOrder selectionSorterOrder) {
3131
this.selectionSorterFactory = selectionSorterFactory;
3232
switch (selectionSorterOrder) {
3333
case ASCENDING:
@@ -72,7 +72,7 @@ public boolean equals(Object other) {
7272
return true;
7373
if (other == null || getClass() != other.getClass())
7474
return false;
75-
SelectionFactorySorter<?, ?> that = (SelectionFactorySorter<?, ?>) other;
75+
FactorySelectionSorter<?, ?> that = (FactorySelectionSorter<?, ?>) other;
7676
return Objects.equals(selectionSorterFactory, that.selectionSorterFactory)
7777
&& Objects.equals(comparator, that.comparator);
7878
}

core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/entity/EntitySelectorFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import ai.timefold.solver.core.impl.heuristic.selector.AbstractSelectorFactory;
2121
import ai.timefold.solver.core.impl.heuristic.selector.common.ValueRangeRecorderId;
2222
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter;
23-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFactorySorter;
23+
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.FactorySelectionSorter;
2424
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFilter;
2525
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionProbabilityWeightFactory;
2626
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorter;
@@ -318,7 +318,7 @@ protected EntitySelector<Solution_> applySorting(SelectionCacheType resolvedCach
318318
} else if (config.getSorterWeightFactoryClass() != null) {
319319
SorterFactory<Solution_, Object> sorterFactory =
320320
instanceCache.newInstance(config, "sorterWeightFactoryClass", config.getSorterWeightFactoryClass());
321-
sorter = new SelectionFactorySorter<>(sorterFactory,
321+
sorter = new FactorySelectionSorter<>(sorterFactory,
322322
SelectionSorterOrder.resolve(config.getSorterOrder()));
323323
} else if (config.getSorterClass() != null) {
324324
sorter = instanceCache.newInstance(config, "sorterClass", config.getSorterClass());

core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/AbstractMoveSelectorFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import ai.timefold.solver.core.impl.heuristic.move.Move;
1313
import ai.timefold.solver.core.impl.heuristic.selector.AbstractSelectorFactory;
1414
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter;
15-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFactorySorter;
15+
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.FactorySelectionSorter;
1616
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFilter;
1717
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionProbabilityWeightFactory;
1818
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorter;
@@ -197,7 +197,7 @@ protected MoveSelector<Solution_> applySorting(SelectionCacheType resolvedCacheT
197197
} else if (sorterWeightFactoryClass != null) {
198198
SorterFactory<Solution_, Move<Solution_>> sorterFactory =
199199
ConfigUtils.newInstance(config, "sorterWeightFactoryClass", sorterWeightFactoryClass);
200-
sorter = new SelectionFactorySorter<>(sorterFactory,
200+
sorter = new FactorySelectionSorter<>(sorterFactory,
201201
SelectionSorterOrder.resolve(config.getSorterOrder()));
202202
} else if (sorterClass != null) {
203203
sorter = ConfigUtils.newInstance(config, "sorterClass", sorterClass);

core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/value/ValueSelectorFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import ai.timefold.solver.core.impl.heuristic.HeuristicConfigPolicy;
2020
import ai.timefold.solver.core.impl.heuristic.selector.AbstractSelectorFactory;
2121
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter;
22-
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFactorySorter;
22+
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.FactorySelectionSorter;
2323
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionFilter;
2424
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionProbabilityWeightFactory;
2525
import ai.timefold.solver.core.impl.heuristic.selector.common.decorator.SelectionSorter;
@@ -338,7 +338,7 @@ protected ValueSelector<Solution_> applySorting(SelectionCacheType resolvedCache
338338
} else if (config.getSorterWeightFactoryClass() != null) {
339339
SorterFactory<Solution_, Object> sorterFactory =
340340
instanceCache.newInstance(config, "sorterWeightFactoryClass", config.getSorterWeightFactoryClass());
341-
sorter = new SelectionFactorySorter<>(sorterFactory,
341+
sorter = new FactorySelectionSorter<>(sorterFactory,
342342
SelectionSorterOrder.resolve(config.getSorterOrder()));
343343
} else if (config.getSorterClass() != null) {
344344
sorter = instanceCache.newInstance(config, "sorterClass", config.getSorterClass());
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
import org.junit.jupiter.api.Test;
1616

17-
class SelectionFactorySorterTest {
17+
class FactorySelectionSorterTest {
1818

1919
@Test
2020
void sortAscending() {
2121
SorterFactory<TestdataSolution, TestdataEntity> weightFactory = (solution, selection) -> Integer
2222
.valueOf(selection.getCode().charAt(0));
23-
SelectionFactorySorter<TestdataSolution, TestdataEntity> selectionSorter = new SelectionFactorySorter<>(
23+
FactorySelectionSorter<TestdataSolution, TestdataEntity> selectionSorter = new FactorySelectionSorter<>(
2424
weightFactory, SelectionSorterOrder.ASCENDING);
2525
ScoreDirector<TestdataSolution> scoreDirector = mock(ScoreDirector.class);
2626
List<TestdataEntity> selectionList = new ArrayList<>();
@@ -36,7 +36,7 @@ void sortAscending() {
3636
void sortDescending() {
3737
SorterFactory<TestdataSolution, TestdataEntity> weightFactory = (solution, selection) -> Integer
3838
.valueOf(selection.getCode().charAt(0));
39-
SelectionFactorySorter<TestdataSolution, TestdataEntity> selectionSorter = new SelectionFactorySorter<>(
39+
FactorySelectionSorter<TestdataSolution, TestdataEntity> selectionSorter = new FactorySelectionSorter<>(
4040
weightFactory, SelectionSorterOrder.DESCENDING);
4141
ScoreDirector<TestdataSolution> scoreDirector = mock(ScoreDirector.class);
4242
List<TestdataEntity> selectionList = new ArrayList<>();

0 commit comments

Comments
 (0)