Skip to content

Commit

Permalink
Fix Solver.solve(deprecated Solution)
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0ffrey committed Apr 4, 2016
1 parent 8ba501a commit 85d744d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
Expand Up @@ -84,18 +84,13 @@ public interface Solver<Solution_> {
Solution_ solve(Solution_ planningProblem); Solution_ solve(Solution_ planningProblem);


/** /**
* Solves the planning problem and returns the best solution encountered * Retained for backwards compatibility with 6.x. This method will be removed in 8.0.
* (which might or might not be optimal, feasible or even initialized). * @param planningProblem never null
* <p> * @return never null
* It can take seconds, minutes, even hours or days before this method returns, * @deprecated In favor of {@link #solve(Object)}
* depending on the {@link Termination} configuration.
* To terminate a {@link Solver} early, call {@link #terminateEarly()}.
* @param planningProblem never null, usually its planning variables are uninitialized
* @return never null, but it can return the original, uninitialized {@link PlanningSolution} with a {@link Score} null.
* @see #terminateEarly()
*/ */
@Deprecated @Deprecated
Solution_ solve(Solution planningProblem); Solution solve(Solution planningProblem);


/** /**
* This method is thread-safe. * This method is thread-safe.
Expand Down
Expand Up @@ -187,13 +187,8 @@ public final Solution_ solve(Solution_ planningProblem) {
return solverScope.getBestSolution(); return solverScope.getBestSolution();
} }


public Solution_ solve(Solution planningProblem) { public Solution solve(Solution planningProblem) {
if (planningProblem == null) { return (Solution) solve((Solution_) planningProblem);
throw new IllegalArgumentException("The planningProblem (" + planningProblem
+ ") must not be null.");
}
// we can do this, since this legacy Solution is in fact the same type as Solution_
return solve((Solution_)planningProblem);
} }


public void outerSolvingStarted(DefaultSolverScope<Solution_> solverScope) { public void outerSolvingStarted(DefaultSolverScope<Solution_> solverScope) {
Expand Down

0 comments on commit 85d744d

Please sign in to comment.