Source:
<code>protected void doMoveOnGenuineVariables(ScoreDirector<Solution_> scoreDirector) { for (int i = 0; i < variableDescriptorList.size(); i++) { GenuineVariableDescriptor<Solution_> variableDescriptor = variableDescriptorList.get(i); Object oldLeftValue = variableDescriptor.getValue(leftEntity); Object oldRightValue = variableDescriptor.getValue(rightEntity); if (!Objects.equals(oldLeftValue, oldRightValue)) { if (!variableDescriptor.isChained()) { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); } else { Object oldLeftTrailingEntity = oldLeftTrailingEntityMap.get(variableDescriptor); <START> Object oldRightTrailingEntity = oldRightTrailingEntityMap.get(variableDescriptor); <END> if (oldRightValue == leftEntity) { scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, rightEntity); if (oldRightTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldRightTrailingEntity, leftEntity); } } else if (oldLeftValue == rightEntity) { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, leftEntity); if (oldLeftTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldLeftTrailingEntity, rightEntity); } } else { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); if (oldRightTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldRightTrailingEntity, leftEntity); } if (oldLeftTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldLeftTrailingEntity, rightEntity); } } } } } }</code><technical_language>I a plannning entity LessonVisit a chained planning variable previous a non-chained planning variable room, this code execute for room too? room behave a normal swap. it? room if trailing entities null, left right? I guess behaves a normal swap move indeed</technical_language>

Target:
protected void doMoveOnGenuineVariables(ScoreDirector<Solution_> scoreDirector) { for (int i = 0; i < variableDescriptorList.size(); i++) { GenuineVariableDescriptor<Solution_> variableDescriptor = variableDescriptorList.get(i); Object oldLeftValue = variableDescriptor.getValue(leftEntity); Object oldRightValue = variableDescriptor.getValue(rightEntity); if (!Objects.equals(oldLeftValue, oldRightValue)) { if (!variableDescriptor.isChained()) { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); } else { Object oldLeftTrailingEntity = oldLeftTrailingEntityList.get(i); Object oldRightTrailingEntity = oldRightTrailingEntityList.get(i); if (oldRightValue == leftEntity) { scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, rightEntity); if (oldRightTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldRightTrailingEntity, leftEntity); } } else if (oldLeftValue == rightEntity) { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, leftEntity); if (oldLeftTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldLeftTrailingEntity, rightEntity); } } else { scoreDirector.changeVariableFacade(variableDescriptor, leftEntity, oldRightValue); scoreDirector.changeVariableFacade(variableDescriptor, rightEntity, oldLeftValue); if (oldRightTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldRightTrailingEntity, leftEntity); } if (oldLeftTrailingEntity != null) { scoreDirector.changeVariableFacade(variableDescriptor, oldLeftTrailingEntity, rightEntity); } } } } } }