public PartitionSize getSize ( Date first , Date last , int maxP ) { long diffMS = last . getTime ( ) - first . getTime ( ) ; for ( PartitionSize pa : sizes ) { long maxMS = maxP * pa . intervalMS ( ) ; if ( maxMS > diffMS ) { return pa ; } } return twoYearSize ; }
Attempt to find the smallest PartitionSize implementation which spanning the range first and last specified produces at most maxP partitions .