Changeset 512 for DCWoRMS/trunk/src/simulator/reader/ResourceReader.java
- Timestamp:
- 10/12/12 13:04:31 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/simulator/reader/ResourceReader.java
r509 r512 9 9 import java.util.ArrayDeque; 10 10 import java.util.ArrayList; 11 import java.util.Collections; 12 import java.util.Comparator; 11 13 import java.util.Deque; 12 14 import java.util.HashMap; … … 27 29 import schedframe.ResourceController; 28 30 import schedframe.exceptions.ResourceException; 31 import schedframe.resources.Resource; 29 32 import schedframe.resources.StandardResourceType; 30 33 import schedframe.resources.computing.ComputingResource; … … 51 54 52 55 protected ResourceCalendar resourceCalendar; 53 protected Deque<Initializable> toInit = new ArrayDeque<Initializable>();56 protected List<Initializable> toInit = new ArrayList<Initializable>(); 54 57 55 58 private ExecutionTimeEstimationPlugin execTimeEstimationPlugin; … … 85 88 86 89 ResourceController rc = new ResourceController(mainScheduler, computingResources); 90 Collections.sort(toInit, new ResourceTypeComparator(new ArrayList<String>(compResLayers))); 87 91 rc.setInitList(toInit); 88 92 rc.setCompResLayers(compResLayers); … … 430 434 } 431 435 436 class ResourceTypeComparator implements Comparator<Initializable>{ 437 438 List<String> order; 439 ResourceTypeComparator(List<String> order) { 440 this.order = order; 441 } 442 public int compare(Initializable init1, Initializable init2) { 443 String type1 = ((Resource)init1).getType().getName(); 444 String type2 = ((Resource)init2).getType().getName(); 445 if(order.indexOf(type1) > order.indexOf(type2)) 446 return -1; 447 else if (order.indexOf(type1) < order.indexOf(type2)) 448 return 1; 449 else return 0; 450 451 } 452 } 453 432 454 }
Note: See TracChangeset
for help on using the changeset viewer.