Class FieldAccessingSolutionCloner<Solution_>

java.lang.Object
ai.timefold.solver.core.impl.domain.solution.cloner.FieldAccessingSolutionCloner<Solution_>
All Implemented Interfaces:
SolutionCloner<Solution_>

public final class FieldAccessingSolutionCloner<Solution_> extends Object implements SolutionCloner<Solution_>
This class is thread-safe; score directors from the same solution descriptor will share the same instance.
  • Constructor Details

  • Method Details

    • cloneSolution

      public @NonNull Solution_ cloneSolution(@NonNull Solution_ originalSolution)
      Description copied from interface: SolutionCloner
      Does a planning clone. The returned PlanningSolution 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 original PlanningSolution must remain unchanged.
      Note that a class might support more than 1 clone method: planning clone is just one of them.

      This method is thread-safe.

      Specified by:
      cloneSolution in interface SolutionCloner<Solution_>
      Parameters:
      originalSolution - the original PlanningSolution
      Returns:
      the cloned PlanningSolution
    • gizmoFallbackDeepClone

      public Object gizmoFallbackDeepClone(Object originalValue, Map<Object,Object> originalToCloneMap)
      Used by GIZMO when it encounters an undeclared entity class, such as when an abstract planning entity is extended.