@Test public void doChangeNonPinnedTask() { workingTask.setPinned(false); doChange(); verifyCommonResults(); }
@Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); }
ReleaseTaskProblemFactChange implements ProblemFactChange<TaskAssigningSolution> { @Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); } }
ReleaseTaskProblemFactChange implements ProblemFactChange<TaskAssigningSolution> { @Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); } ReleaseTaskProblemFactChange(Task task); }
ReleaseTaskProblemFactChange implements ProblemFactChange<TaskAssigningSolution> { @Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); } ReleaseTaskProblemFactChange(Task task); Task getTask(); @Override void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector); }
ReleaseTaskProblemFactChange implements ProblemFactChange<TaskAssigningSolution> { @Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); } ReleaseTaskProblemFactChange(Task task); Task getTask(); @Override void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector);  }