Class IntervalsByGranularity


  • public class IntervalsByGranularity
    extends Object
    Produce a stream of intervals generated by a given set of intervals as input and a given granularity. This class avoids materializing the granularity intervals whenever possible.
    • Constructor Detail

      • IntervalsByGranularity

        public IntervalsByGranularity​(Collection<org.joda.time.Interval> intervals,
                                      Granularity granularity)
        Parameters:
        intervals - Intervals for which to apply the given granularity. They should not contain overlapped intervals.
        granularity - The granularity to apply
        Throws:
        IAE - if intervals contains at least an overlapping pair
    • Method Detail

      • granularityIntervalsIterator

        public Iterator<org.joda.time.Interval> granularityIntervalsIterator()
        Returns:
        The intervals according the granularity. The intervals are provided in order according to Comparators.intervalsByStartThenEnd()