/** * Sort in the order from the least new amount of resources asked (likely * negative) to the highest. This prevents "order-of-operation" errors related * to exceeding 100% capacity temporarily. * * @param currentReservations the currently active reservations * @param now the current time * @param plan the {@link Plan} that is being considered * * @return the sorted list of {@link ReservationAllocation}s */ protected List<ReservationAllocation> sortByDelta( List<ReservationAllocation> currentReservations, long now, Plan plan) { Collections.sort(currentReservations, new ReservationAllocationComparator(now, this, plan)); return currentReservations; }
@Override public int compare(ReservationAllocation lhs, ReservationAllocation rhs) { // compute delta between current and previous reservation, and compare // based on that Resource lhsRes = getUnallocatedReservedResources(lhs); Resource rhsRes = getUnallocatedReservedResources(rhs); return lhsRes.compareTo(rhsRes); } }
/** * Sort in the order from the least new amount of resources asked (likely * negative) to the highest. This prevents "order-of-operation" errors related * to exceeding 100% capacity temporarily. */ protected List<ReservationAllocation> sortByDelta( List<ReservationAllocation> currentReservations, long now, Plan plan) { Collections.sort(currentReservations, new ReservationAllocationComparator( now, this, plan)); return currentReservations; }
/** * Sort in the order from the least new amount of resources asked (likely * negative) to the highest. This prevents "order-of-operation" errors related * to exceeding 100% capacity temporarily. */ protected List<ReservationAllocation> sortByDelta( List<ReservationAllocation> currentReservations, long now, Plan plan) { Collections.sort(currentReservations, new ReservationAllocationComparator( now, this, plan)); return currentReservations; }
@Override public int compare(ReservationAllocation lhs, ReservationAllocation rhs) { // compute delta between current and previous reservation, and compare // based on that Resource lhsRes = getUnallocatedReservedResources(lhs); Resource rhsRes = getUnallocatedReservedResources(rhs); return lhsRes.compareTo(rhsRes); } }
@Override public int compare(ReservationAllocation lhs, ReservationAllocation rhs) { // compute delta between current and previous reservation, and compare // based on that Resource lhsRes = getUnallocatedReservedResources(lhs); Resource rhsRes = getUnallocatedReservedResources(rhs); return lhsRes.compareTo(rhsRes); } }