/** * {@inheritDoc} */ @Override public void removeFromPriorityList(Application.Name applicationName, Experiment.ID experimentID) { List<Experiment.ID> priorityList = prioritiesRepository.getPriorityList(applicationName); if (priorityList != null && priorityList.contains(experimentID)) { priorityList.remove(experimentID); prioritiesRepository.createPriorities(applicationName, priorityList); } }
List<Experiment.ID> experimentPriorityList = prioritiesRepository.getPriorityList(applicationName); if (experimentPriorityList.contains(experimentID)) {
/** * {@inheritDoc} */ @Override public void appendToPriorityList(Experiment.ID experimentID) { Application.Name applicationName = experiments.getExperiment(experimentID).getApplicationName(); List<Experiment.ID> priorityList = prioritiesRepository.getPriorityList(applicationName); if (priorityList == null) { priorityList = new ArrayList<>(1); } // TODO: This current logic does not modify the priority list if the given experimentID already exists in the // priority list. Check if it would be better to move the given experiment to the end of the list if it // already exists if (!priorityList.contains(experimentID)) { priorityList.add(experimentID); prioritiesRepository.createPriorities(applicationName, priorityList); } }
/** * {@inheritDoc} */ @Override public PrioritizedExperimentList getPriorities(Application.Name applicationName, boolean verifyPriorityList) { if (verifyPriorityList) { List<Experiment.ID> priorityList = prioritiesRepository.getPriorityList(applicationName); List<Experiment> experimentList = experiments.getExperiments(applicationName); if ((priorityList != null ? priorityList.size() : 0) != experimentList.size()) { prioritiesRepository.createPriorities(applicationName, cleanPriorityList(applicationName, priorityList)); } } return prioritiesRepository.getPriorities(applicationName); }