Ejemplo n.º 1
0
 public Collection<? extends Object> getPlanningValues() {
   List<Object> values = new ArrayList<Object>(variableDescriptors.size() * 2);
   for (PlanningVariableDescriptor planningVariableDescriptor : variableDescriptors) {
     values.add(planningVariableDescriptor.getValue(leftEntity));
     values.add(planningVariableDescriptor.getValue(rightEntity));
   }
   return values;
 }
Ejemplo n.º 2
0
 public boolean isMoveDoable(ScoreDirector scoreDirector) {
   for (PlanningVariableDescriptor planningVariableDescriptor : variableDescriptors) {
     Object leftValue = planningVariableDescriptor.getValue(leftEntity);
     Object rightValue = planningVariableDescriptor.getValue(rightEntity);
     if (!ObjectUtils.equals(leftValue, rightValue)) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 3
0
 public void doMove(ScoreDirector scoreDirector) {
   for (PlanningVariableDescriptor planningVariableDescriptor : variableDescriptors) {
     Object oldLeftValue = planningVariableDescriptor.getValue(leftEntity);
     Object oldRightValue = planningVariableDescriptor.getValue(rightEntity);
     if (!ObjectUtils.equals(oldLeftValue, oldRightValue)) {
       scoreDirector.beforeVariableChanged(
           leftEntity, planningVariableDescriptor.getVariableName());
       planningVariableDescriptor.setValue(leftEntity, oldRightValue);
       scoreDirector.afterVariableChanged(
           leftEntity, planningVariableDescriptor.getVariableName());
       scoreDirector.beforeVariableChanged(
           rightEntity, planningVariableDescriptor.getVariableName());
       planningVariableDescriptor.setValue(rightEntity, oldLeftValue);
       scoreDirector.afterVariableChanged(
           rightEntity, planningVariableDescriptor.getVariableName());
     }
   }
 }