@@ -31,7 +31,7 @@ public interface PhaseCommandContext<Solution_>
3131 /**
3232 * Returns the current working solution.
3333 * It must not be modified directly,
34- * but only through {@link #executeAndCalculateScore (Move)} or {@link #executeTemporarily(Move, Function)} .
34+ * but only through {@link #execute (Move)} and other similar methods on this interface .
3535 * Direct modifications will cause the solver to be in an inconsistent state and likely throw an exception later on.
3636 *
3737 * @return the current working solution
@@ -65,30 +65,41 @@ public interface PhaseCommandContext<Solution_>
6565 */
6666 <Score_ extends Score <Score_ >> Score_ executeAndCalculateScore (Move <Solution_ > move );
6767
68- /**
69- * As defined by {@link #executeTemporarily(Move, Function, boolean)},
70- * with the guarantee of a fresh score.
71- */
72- default <Result_ > @ Nullable Result_ executeTemporarily (Move <Solution_ > move ,
73- Function <Solution_ , @ Nullable Result_ > temporarySolutionConsumer ) {
74- return executeTemporarily (move , temporarySolutionConsumer , true );
75- }
76-
7768 /**
7869 * Executes the given move temporarily and returns the result of the given consumer.
7970 * The working solution is reverted to its original state after the consumer has been executed,
80- * optionally without recalculating the score for performance reasons.
71+ * except for the score, which is not recalculated for performance reasons.
8172 *
8273 * @param move the move to execute temporarily
8374 * @param temporarySolutionConsumer the consumer to execute with the temporarily modified solution;
8475 * this solution must not be modified any further.
85- * @param guaranteeFreshScore if true, the score of {@link #getWorkingSolution()} after this method returns
86- * is guaranteed to be up-to-date;
87- * otherwise it may be stale as the solver will skip recalculating it for performance reasons.
8876 * @return the result of the consumer
8977 */
9078 <Result_ > @ Nullable Result_ executeTemporarily (Move <Solution_ > move ,
91- Function <Solution_ , @ Nullable Result_ > temporarySolutionConsumer , boolean guaranteeFreshScore );
79+ Function <Solution_ , @ Nullable Result_ > temporarySolutionConsumer );
80+
81+ /**
82+ * Executes the given move temporarily and returns the score of the temporarily modified solution.
83+ * The working solution is reverted to its original state after the consumer has been executed,
84+ * except for the score, which is not recalculated for performance reasons.
85+ *
86+ * @param move the move to execute temporarily
87+ * @return the score of the temporarily modified solution after executing the move
88+ */
89+ <Score_ extends Score <Score_ >> Score_ executeTemporarily (Move <Solution_ > move );
90+
91+ /**
92+ * As defined by {@link #executeTemporarily(Move)},
93+ * with the guarantee of a fresh score at the end of the method's invocation.
94+ */
95+ <Score_ extends Score <Score_ >> Score_ executeTemporarilyAndCalculateScore (Move <Solution_ > move );
96+
97+ /**
98+ * As defined by {@link #executeTemporarily(Move, Function)},
99+ * with the guarantee of a fresh score at the end of the method's invocation.
100+ */
101+ <Result_ > @ Nullable Result_ executeTemporarilyAndCalculateScore (Move <Solution_ > move ,
102+ Function <Solution_ , @ Nullable Result_ > temporarySolutionConsumer );
92103
93104 @ Override
94105 <T > @ Nullable T lookUpWorkingObject (@ Nullable T problemFactOrPlanningEntity );
0 commit comments