protected Address findNewBackupOwner(Builder builder, Collection<Address> excludes, Address owner) {
      // We want the owned/capacity ratio of the actual owner after removing the current segment to be bigger
      // than the owned/capacity ratio of the new owner after adding the current segment, so that a future pass
      // won't try to switch them back.
      Address best = null;
      float initialCapacityFactor = owner != null ? builder.getCapacityFactor(owner) : 0;
      float bestSegmentsPerCapacity = initialCapacityFactor != 0 ? (builder.getOwned(owner) - 1 ) / initialCapacityFactor :
            Float.MAX_VALUE;
      for (Address candidate : builder.getMembers()) {
         if (excludes == null || !excludes.contains(candidate)) {
            int owned = builder.getOwned(candidate);
            float capacityFactor = builder.getCapacityFactor(candidate);
            if ((owned + 1) <= capacityFactor * bestSegmentsPerCapacity) {
               best = candidate;
               bestSegmentsPerCapacity = (owned + 1) / capacityFactor;
            }
         }
      }

      return best;
   }
protected Address findNewBackupOwner ( Builder builder , Collection < Address > excludes , Address owner ) { Address best = null ; float initialCapacityFactor = owner != null ? builder . getCapacityFactor ( owner ) : 0 ; float bestSegmentsPerCapacity = initialCapacityFactor != 0 ? ( builder . getOwned ( owner ) - 1 ) / initialCapacityFactor : Float . MAX_VALUE ; for ( Address candidate : builder . getMembers ( ) ) { if ( excludes == null || ! excludes . contains ( candidate ) ) { int owned = builder . getOwned ( candidate ) ; float capacityFactor = builder . getCapacityFactor ( candidate ) ; if ( ( owned + 1 ) <= capacityFactor * bestSegmentsPerCapacity ) { best = candidate ; bestSegmentsPerCapacity = ( owned + 1 ) / capacityFactor ; } } } return best ; }
@return The member with the worst owned segments/capacity ratio that is also not in the excludes list.