public List < Partition < T > > getRange ( PartitionSize size , Date start , Date end ) { // logDates("Constructing partitions Size(" + size.name() + ")",start,end); // Date origStart = new Date(start.getTime()); List < Partition < T >> partitions = new ArrayList < Partition < T > > ( ) ; Calendar cStart = Calendar . getInstance ( TZ_UTC ) ; cStart . setTime ( start ) ; size . alignStart ( cStart ) ; // logDates("AlignedStart("+size.name()+")",origStart,cStart.getTime()); Calendar cEnd = size . increment ( cStart , 1 ) ; // logDates("AlignedEnd("+size.name()+")",cStart.getTime(),cEnd.getTime()); while ( cStart . getTime ( ) . compareTo ( end ) < 0 ) { partitions . add ( new Partition < T > ( cStart . getTime ( ) , cEnd . getTime ( ) ) ) ; cStart = cEnd ; cEnd = size . increment ( cStart , 1 ) ; // logDates("Incremented("+size.name()+")", // cStart.getTime(),cEnd.getTime()); } return partitions ; }
Create a List of Partition objects of the specified size which span the date range specified .