Remove reloadElementInQueue()

It's not necessary to call it as queues are refreshed later and its elements
are shown at their correct position. In addition, this method was
causing trouble as sometimes an element was successfully removed but not
sucessfully added to the same queue.

FEA: ItEr66OTS03AlgoritmosLimitantesItEr65OTS05
This commit is contained in:
Diego Pino Garcia 2010-12-27 18:10:43 +01:00
parent 9dbcf0c006
commit e4a5ca5ebe
2 changed files with 1 additions and 25 deletions

View file

@ -33,6 +33,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.navalplanner.business.common.BaseEntity;
import org.navalplanner.business.orders.entities.OrderElement;
import org.navalplanner.business.planner.limiting.entities.DateAndHour;
import org.navalplanner.business.planner.limiting.entities.Gap;
import org.navalplanner.business.planner.limiting.entities.Gap.GapOnQueue;
@ -160,25 +161,6 @@ public class LimitingResourceQueue extends BaseEntity {
invalidCachedGaps();
}
/**
* limitingResourceQueueElements is a SortedSet of
* {@link LimitingResourceQueueElement} ordered by startDate
*
* When an element if shifted visually in a list of queue elements, it might
* be necessary to rearrange the SortedSet so the new element occupies its
* real position. Instead of rearranging the SortedSet again, the element is
* removed from the set and inserted again. Insert operation guarantees that
* an element is inserted at the right position
*
*/
public void reloadLimitingResourceQueueElement(
LimitingResourceQueueElement element) {
if (limitingResourceQueueElements.contains(element)) {
limitingResourceQueueElements.remove(element);
limitingResourceQueueElements.add(element);
}
}
public String toString() {
return getResource() != null ? getResource().getName() : "";
}

View file

@ -488,18 +488,12 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
applyAllocation(each);
LimitingResourceQueueElement element = each.getElement();
reloadElementInQueue(element);
result.add(element);
}
return result;
}
private void reloadElementInQueue(LimitingResourceQueueElement element) {
final LimitingResourceQueue queue = element.getLimitingResourceQueue();
queue.reloadLimitingResourceQueueElement(element);
}
private List<AllocationSpec> getAllocationsToBeDone(
DirectedGraph<LimitingResourceQueueElement, Edge> potentiallyAffectedByInsertion,
LimitingResourceQueueElement elementInserted,