private static double assignShareIfUnderAllocated ( double totalShare , final Collection < ? extends Schedulable > schedulables ) { double totalMinDemand = 0 ; for ( Schedulable schedulable : schedulables ) { schedulable . share = 0 ; totalMinDemand += Math . min ( schedulable . getRequested ( ) , schedulable . getMinimum ( ) ) ; } if ( ( totalMinDemand > 0 ) && ( totalMinDemand >= totalShare ) ) { distributeShareMin ( schedulables ) ; } return totalShare - totalMinDemand ; }
Assign fair share if total share < min demand .