Example #1
0
 public int compare(HostData o1, HostData o2) {
   double compare =
       o1.getCurrentStatus().getResourcesInUse().getCpu()
           - o2.getCurrentStatus().getResourcesInUse().getCpu();
   if (compare < 0) return -1;
   else if (compare > 0) return 1;
   return 0;
 }
Example #2
0
 public int compare(HostData o1, HostData o2) {
   double compare =
       (o1.getCurrentStatus().getResourcesInUse().getCpu()
               / o1.getHostDescription().getResourceCapacity().getCpu())
           - (o2.getCurrentStatus().getResourcesInUse().getCpu()
               / o2.getHostDescription().getResourceCapacity().getCpu());
   if (compare < 0) return -1;
   else if (compare > 0) return 1;
   return 0;
 }
Example #3
0
    public int compare(HostData o1, HostData o2) {
      int o1State;
      int o2State;

      if (o1.getCurrentStatus().getState() == Host.HostState.ON) o1State = 2;
      else if (o1.getCurrentStatus().getState() == Host.HostState.SUSPENDED) o1State = 1;
      else o1State = 0; // ranks off and transition states lowest

      if (o2.getCurrentStatus().getState() == Host.HostState.ON) o2State = 2;
      else if (o2.getCurrentStatus().getState() == Host.HostState.SUSPENDED) o2State = 1;
      else o2State = 0; // ranks off and transition states lowest

      return o1State - o2State;
    }