Class DefaultProblemChangeDirector<Solution_>
- java.lang.Object
- 
- org.optaplanner.core.impl.solver.change.DefaultProblemChangeDirector<Solution_>
 
- 
- All Implemented Interfaces:
- ProblemChangeDirector
 
 public final class DefaultProblemChangeDirector<Solution_> extends Object implements ProblemChangeDirector 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultProblemChangeDirector(ScoreDirector<Solution_> scoreDirector)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <Entity> voidaddEntity(Entity entity, Consumer<Entity> entityConsumer)Add a newPlanningEntityinstance into theworking solution.<ProblemFact>
 voidaddProblemFact(ProblemFact problemFact, Consumer<ProblemFact> problemFactConsumer)Add a new problem fact into theworking solution.<EntityOrProblemFact>
 voidchangeProblemProperty(EntityOrProblemFact problemFactOrEntity, Consumer<EntityOrProblemFact> problemFactOrEntityConsumer)Change a property of either aPlanningEntityor a problem fact.<Entity> voidchangeVariable(Entity entity, String variableName, Consumer<Entity> entityConsumer)Change aPlanningVariablevalue of aPlanningEntity.<EntityOrProblemFact>
 Optional<EntityOrProblemFact>lookUpWorkingObject(EntityOrProblemFact externalObject)As defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object), but doesn't fail fast if no workingObject was ever added for the externalObject.<EntityOrProblemFact>
 EntityOrProblemFactlookUpWorkingObjectOrFail(EntityOrProblemFact externalObject)Translate an entity or fact instance (often from anotherThreador JVM) to thisProblemChangeDirector's internal working instance.<Entity> voidremoveEntity(Entity entity, Consumer<Entity> entityConsumer)Remove an existingPlanningEntityinstance from theworking solution.<ProblemFact>
 voidremoveProblemFact(ProblemFact problemFact, Consumer<ProblemFact> problemFactConsumer)Remove an existing problem fact from theworking solution.
 
- 
- 
- 
Constructor Detail- 
DefaultProblemChangeDirectorpublic DefaultProblemChangeDirector(ScoreDirector<Solution_> scoreDirector) 
 
- 
 - 
Method Detail- 
addEntitypublic <Entity> void addEntity(Entity entity, Consumer<Entity> entityConsumer)Description copied from interface:ProblemChangeDirectorAdd a newPlanningEntityinstance into theworking solution.- Specified by:
- addEntityin interface- ProblemChangeDirector
- Type Parameters:
- Entity- the planning entity object type
- Parameters:
- entity- never null; the- PlanningEntityinstance
- entityConsumer- never null; adds the entity to the- working solution
 
 - 
removeEntitypublic <Entity> void removeEntity(Entity entity, Consumer<Entity> entityConsumer)Description copied from interface:ProblemChangeDirectorRemove an existingPlanningEntityinstance from theworking solution. Translates the entity to a working planning entity by performing a lookup as defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object).- Specified by:
- removeEntityin interface- ProblemChangeDirector
- Type Parameters:
- Entity- the planning entity object type
- Parameters:
- entity- never null; the- PlanningEntityinstance
- entityConsumer- never null; removes the working entity from the- working solution
 
 - 
changeVariablepublic <Entity> void changeVariable(Entity entity, String variableName, Consumer<Entity> entityConsumer)Description copied from interface:ProblemChangeDirectorChange aPlanningVariablevalue of aPlanningEntity. Translates the entity to a working planning entity by performing a lookup as defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object).- Specified by:
- changeVariablein interface- ProblemChangeDirector
- Type Parameters:
- Entity- the planning entity object type
- Parameters:
- entity- never null; the- PlanningEntityinstance
- variableName- never null; name of the- PlanningVariable
- entityConsumer- never null; updates the value of the the- PlanningVariableinside the- PlanningEntity
 
 - 
addProblemFactpublic <ProblemFact> void addProblemFact(ProblemFact problemFact, Consumer<ProblemFact> problemFactConsumer)Description copied from interface:ProblemChangeDirectorAdd a new problem fact into theworking solution.- Specified by:
- addProblemFactin interface- ProblemChangeDirector
- Type Parameters:
- ProblemFact- the problem fact object type
- Parameters:
- problemFact- never null; the problem fact instance
- problemFactConsumer- never null; removes the working problem fact from the- working solution
 
 - 
removeProblemFactpublic <ProblemFact> void removeProblemFact(ProblemFact problemFact, Consumer<ProblemFact> problemFactConsumer)Description copied from interface:ProblemChangeDirectorRemove an existing problem fact from theworking solution. Translates the problem fact to a working problem fact by performing a lookup as defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object).- Specified by:
- removeProblemFactin interface- ProblemChangeDirector
- Type Parameters:
- ProblemFact- the problem fact object type
- Parameters:
- problemFact- never null; the problem fact instance
- problemFactConsumer- never null; removes the working problem fact from the- working solution
 
 - 
changeProblemPropertypublic <EntityOrProblemFact> void changeProblemProperty(EntityOrProblemFact problemFactOrEntity, Consumer<EntityOrProblemFact> problemFactOrEntityConsumer)Description copied from interface:ProblemChangeDirectorChange a property of either aPlanningEntityor a problem fact. Translates the entity or the problem fact to itsworking solutioncounterpart by performing a lookup as defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object).- Specified by:
- changeProblemPropertyin interface- ProblemChangeDirector
- Type Parameters:
- EntityOrProblemFact- the planning entity or problem fact object type
- Parameters:
- problemFactOrEntity- never null; the- PlanningEntityor the problem fact instance
- problemFactOrEntityConsumer- never null; updates the property of the- PlanningEntityor the problem fact
 
 - 
lookUpWorkingObjectOrFailpublic <EntityOrProblemFact> EntityOrProblemFact lookUpWorkingObjectOrFail(EntityOrProblemFact externalObject) Description copied from interface:ProblemChangeDirectorTranslate an entity or fact instance (often from anotherThreador JVM) to thisProblemChangeDirector's internal working instance.Matching is determined by the LookUpStrategyTypeonPlanningSolution. Matching uses aPlanningIdby default.- Specified by:
- lookUpWorkingObjectOrFailin interface- ProblemChangeDirector
- Type Parameters:
- EntityOrProblemFact- the object type
- Parameters:
- externalObject- sometimes null
- Returns:
- null if externalObject is null
 
 - 
lookUpWorkingObjectpublic <EntityOrProblemFact> Optional<EntityOrProblemFact> lookUpWorkingObject(EntityOrProblemFact externalObject) Description copied from interface:ProblemChangeDirectorAs defined byProblemChangeDirector.lookUpWorkingObjectOrFail(Object), but doesn't fail fast if no workingObject was ever added for the externalObject. It's recommended to useProblemChangeDirector.lookUpWorkingObjectOrFail(Object)instead.- Specified by:
- lookUpWorkingObjectin interface- ProblemChangeDirector
- Type Parameters:
- EntityOrProblemFact- the object type
- Parameters:
- externalObject- sometimes null
- Returns:
- Optional.empty()if externalObject is null or if there is no workingObject for externalObject
 
 
- 
 
-