blueflood-core/src/main/java/com/rackspacecloud/blueflood/types/Range.java
public static Map<Range, Iterable<Range>> mapFinerRanges(Granularity g, Range range) throws GranularityException {

        if(range.getStart() >= range.getStop())
            throw new IllegalArgumentException("start cannot be greater than end. Start: " + range.getStart() + " Stop:" + range.getStop());

        final long snappedStartMillis = g.snapMillis(range.getStart());
        final long snappedStopMillis = g.snapMillis(range.getStop() + g.milliseconds());
        HashMap<Range, Iterable<Range>> rangeMap = new HashMap<Range, Iterable<Range>>();
        long tempStartMillis = snappedStartMillis;
        int numberOfMillis = g.milliseconds();

        while (tempStartMillis <= (snappedStopMillis - numberOfMillis)) {
            Range slotRange = new Range(tempStartMillis, tempStartMillis + numberOfMillis);
            rangeMap.put(slotRange, new IntervalRangeIterator(g.finer(), slotRange.start, slotRange.stop));
            tempStartMillis = tempStartMillis + numberOfMillis;
        }

        return rangeMap;
    }
public static Map<Range, Iterable<Range>> mapFinerRanges(Granularity g, Range range) throws GranularityException {

        if(range.getStart() >= range.getStop())
            throw new IllegalArgumentException("start cannot be greater than end. Start: " + range.getStart() + " Stop:" + range.getStop());

        final long snappedStartMillis = g.snapMillis(range.getStart());
        final long snappedStopMillis = g.snapMillis(range.getStop() + g.milliseconds());
        HashMap<Range, Iterable<Range>> rangeMap = new HashMap<Range, Iterable<Range>>();
        long tempStartMillis = snappedStartMillis;
        int numberOfMillis = g.milliseconds();

        while (tempStartMillis <= (snappedStopMillis - numberOfMillis)) {
            Range slotRange = new Range(tempStartMillis, tempStartMillis + numberOfMillis);
            rangeMap.put(slotRange, new IntervalRangeIterator(g.finer(), slotRange.start, slotRange.stop));
            tempStartMillis = tempStartMillis + numberOfMillis;
        }

        return rangeMap;
    }
public static Map < Range , Iterable < Range > > mapFinerRanges ( Granularity g , Range range ) throws GranularityException { if ( range . getStart ( ) >= range . getStop ( ) ) throw new IllegalArgumentException ( "start cannot be greater than end. Start: " + range . getStart ( ) + " Stop:" + range . getStop ( ) ) ; final long snappedStartMillis = g . snapMillis ( range . getStart ( ) ) ; final long snappedStopMillis = g . snapMillis ( range . getStop ( ) + g . milliseconds ( ) ) ; HashMap < Range , Iterable < Range > > rangeMap = new HashMap < Range , Iterable < Range > > ( ) ; long tempStartMillis = snappedStartMillis ; int numberOfMillis = g . milliseconds ( ) ; while ( tempStartMillis <= ( snappedStopMillis - numberOfMillis ) ) { Range slotRange = new Range ( tempStartMillis , tempStartMillis + numberOfMillis ) ; rangeMap . put ( slotRange , new IntervalRangeIterator ( g . finer ( ) , slotRange . start , slotRange . stop ) ) ; tempStartMillis = tempStartMillis + numberOfMillis ; } return rangeMap ; }
Returns a mapping of ranges in the coarser granularity to the sub-ranges in finer granularity

Here is an example: Given start/end (s,e), we need to return mapping between ranges in Y that will be mapped to
a single range in X. From the example above, it will be mapping from A to all the sub-ranges in Y that get rolled
to a single point in A
@param g Coarser Granularity
@param range Range to be mapped
@return
@throws GranularityException
Returns a mapping of ranges in the coarser granularity to the sub - ranges in finer granularity