public void constructCache(DefaultSolverScope solverScope) { // TODO FIXME extractAllPlanningValues filters out uninitialized entities of another variable Collection<?> planningValues = variableDescriptor.extractAllPlanningValues(solverScope.getWorkingSolution()); cachedValueList = new ArrayList<Object>(planningValues.size() + 1); cachedValueList.addAll(planningValues); if (variableDescriptor.isNullable()) { cachedValueList.add(null); } }
public boolean isMoveDoable(WorkingMemory workingMemory) { for (PlanningVariableDescriptor planningVariableDescriptor : planningVariableDescriptors) { Object leftValue = planningVariableDescriptor.getValue(leftPlanningEntityList.get(0)); Object rightValue = planningVariableDescriptor.getValue(rightPlanningEntityList.get(0)); if (!ObjectUtils.equals(leftValue, rightValue)) { return true; } } return false; }
public void doMove(WorkingMemory workingMemory) { for (PlanningVariableDescriptor planningVariableDescriptor : planningVariableDescriptors) { Object leftValue = planningVariableDescriptor.getValue(leftPlanningEntityList.get(0)); Object rightValue = planningVariableDescriptor.getValue(rightPlanningEntityList.get(0)); if (!ObjectUtils.equals(leftValue, rightValue)) { for (Object leftPlanningEntity : leftPlanningEntityList) { planningVariableDescriptor.setValue(leftPlanningEntity, rightValue); workingMemory.update(workingMemory.getFactHandle(leftPlanningEntity), leftPlanningEntity); } for (Object rightPlanningEntity : rightPlanningEntityList) { planningVariableDescriptor.setValue(rightPlanningEntity, leftValue); workingMemory.update( workingMemory.getFactHandle(rightPlanningEntity), rightPlanningEntity); } } } }
public boolean isContinuous() { return variableDescriptor.isContinuous(); }
@Override public String toString() { return getClass().getSimpleName() + "(" + variableDescriptor.getVariableName() + ")"; }