class TimelineUtilities {

    public static List<TimeSpan> getIntervalsForSpan(Date startDate, TimeSpan span, int spanType)
    {
        List<TimeSpan> intervals = New.list();
        Date currentStart = startDate;
        while (currentStart.getTime() < span.getEndDate().getTime())
        {
            GregorianCalendar endCal = new GregorianCalendar();
            endCal.setTime(currentStart);
            endCal.add(spanType, 1);
            intervals.add(TimeSpan.get(currentStart, endCal.getTime()));

            currentStart = endCal.getTime();
        }
        return intervals;
    }

    private  TimelineUtilities();

}