Permalink
Browse files

removed descendingSet() from PricingModelTestUtils

  • Loading branch information...
1 parent 4dcfa0c commit 8b72b4a6d912f222d9e38cf1e7bd8ef43029282c @pauloricardomg pauloricardomg committed Jul 8, 2010
@@ -1,7 +1,9 @@
package org.globus.workspace.spotinstances;
import java.util.Collection;
-import java.util.TreeSet;
+import java.util.LinkedList;
+
+import edu.emory.mathcs.backport.java.util.Collections;
public class PricingModelTestUtils {
@@ -20,11 +22,13 @@ private static boolean checkMinimumPriceCOnstant(Double nextPrice) {
private static boolean checkSpotInstancesConstraint(Double nextPrice,
Integer totalReservedResources, Collection<SIRequest> requests) {
- TreeSet<SIRequest> orderedRequests = new TreeSet<SIRequest>(requests);
+
+ LinkedList<SIRequest> reverseOrderedRequests = new LinkedList<SIRequest>(requests);
+ Collections.sort(reverseOrderedRequests, Collections.reverseOrder());
Integer availableResources = totalReservedResources;
- for (SIRequest siRequest : orderedRequests.descendingSet()) {
+ for (SIRequest siRequest : reverseOrderedRequests) {
if(availableResources > 0){
if(siRequest.getMaxBid() >= nextPrice){
availableResources -= siRequest.getNeededInstances();

0 comments on commit 8b72b4a

Please sign in to comment.