public void resetTrailingEntityMap(Solution workingSolution) { if (hasChainedVariables) { List<Object> entityList = solutionDescriptor.getEntityList(workingSolution); for (Map.Entry<PlanningVariableDescriptor, Map<Object, Set<Object>>> entry : trailingEntitiesMap.entrySet()) { entry.setValue(new IdentityHashMap<Object, Set<Object>>(entityList.size())); } // TODO Remove when all starting entities call afterEntityAdded too for (Object entity : entityList) { insertInTrailingEntityMap( solutionDescriptor.getEntityDescriptor(entity.getClass()), entity); } } }
protected SolutionDescriptor buildSolutionDescriptor() { if (solutionClass == null) { throw new IllegalArgumentException( "Configure a <solutionClass> in the solver configuration."); } SolutionDescriptor solutionDescriptor = new SolutionDescriptor(solutionClass); solutionDescriptor.processAnnotations(); if (CollectionUtils.isEmpty(planningEntityClassList)) { throw new IllegalArgumentException( "Configure at least 1 <planningEntityClass> in the solver configuration."); } for (Class<?> planningEntityClass : planningEntityClassList) { PlanningEntityDescriptor entityDescriptor = new PlanningEntityDescriptor(solutionDescriptor, planningEntityClass); solutionDescriptor.addPlanningEntityDescriptor(entityDescriptor); entityDescriptor.processAnnotations(); } solutionDescriptor.afterAnnotationsProcessed(); return solutionDescriptor; }
public TrailingEntityMapSupport(SolutionDescriptor solutionDescriptor) { this.solutionDescriptor = solutionDescriptor; Collection<PlanningVariableDescriptor> chainedVariableDescriptors = solutionDescriptor.getChainedVariableDescriptors(); hasChainedVariables = !chainedVariableDescriptors.isEmpty(); trailingEntitiesMap = new LinkedHashMap<PlanningVariableDescriptor, Map<Object, Set<Object>>>( chainedVariableDescriptors.size()); for (PlanningVariableDescriptor chainedVariableDescriptor : chainedVariableDescriptors) { trailingEntitiesMap.put(chainedVariableDescriptor, null); } }