public int getAdsCountToPublish ( int fetchedAdsCount , int sourceItemsCount ) { if ( fetchedAdsCount <= 0 || getNoOfDataBetweenAds ( ) <= 0 ) return 0 ; int expected = 0 ; if ( sourceItemsCount > 0 && sourceItemsCount >= getOffsetValue ( ) + 1 ) expected = ( sourceItemsCount - getOffsetValue ( ) ) / getNoOfDataBetweenAds ( ) + 1 ; expected = Math . max ( 0 , expected ) ; expected = Math . min ( fetchedAdsCount , expected ) ; return Math . min ( expected , getLimitOfAds ( ) ) ; }
Gets the count of ads that could be published