Class FieldAccessingSolutionCloner<Solution_>
- java.lang.Object
-
- org.optaplanner.core.impl.domain.solution.cloner.FieldAccessingSolutionCloner<Solution_>
-
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Implemented Interfaces:
SolutionCloner<Solution_>
public final class FieldAccessingSolutionCloner<Solution_> extends Object implements SolutionCloner<Solution_>
-
-
Constructor Summary
Constructors Constructor Description FieldAccessingSolutionCloner(SolutionDescriptor<Solution_> solutionDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Solution_
cloneSolution(Solution_ originalSolution)
Does a planning clone.
-
-
-
Constructor Detail
-
FieldAccessingSolutionCloner
public FieldAccessingSolutionCloner(SolutionDescriptor<Solution_> solutionDescriptor)
-
-
Method Detail
-
cloneSolution
public Solution_ cloneSolution(Solution_ originalSolution)
Description copied from interface:SolutionCloner
Does a planning clone. The returnedPlanningSolution
clone must fulfill these requirements:- The clone must represent the same planning problem.
Usually it reuses the same instances of the problem facts and problem fact collections as the
original
. - The clone must have the same (equal) score as the
original
. - The clone must use different, cloned instances of the entities and entity collections.
If a cloned entity changes, the original must remain unchanged.
If an entity is added or removed in a cloned
PlanningSolution
, the originalPlanningSolution
must remain unchanged.
This method is thread-safe.
- Specified by:
cloneSolution
in interfaceSolutionCloner<Solution_>
- Parameters:
originalSolution
- never null, the originalPlanningSolution
- Returns:
- never null, the cloned
PlanningSolution
- The clone must represent the same planning problem.
Usually it reuses the same instances of the problem facts and problem fact collections as the
-
-