RADateRanges { public static RADateRanges create(String dateRangesString) throws ParseException { String[] dateRangesStrings = dateRangesString.split(","); long[][] dateRanges = new long[dateRangesStrings.length][2]; for (int i = 0; i < dateRangesStrings.length; i++) { String dateRangeString = dateRangesStrings[i]; DateRange dateRange = DateRange.parseDateRange(dateRangeString); dateRanges[i][0] = dateRange.getStartDate().getTime(); dateRanges[i][1] = dateRange.getStopDate().getTime() + 24 * 60 * 60 * 1000L; } return new RADateRanges(dateRanges); } private  RADateRanges(long[][] dateRanges); static RADateRanges create(String dateRangesString); int findIndex(long time); String format(long time); String formatStart(int index); String formatEnd(int index); static final DateFormat dateFormat; }
@Test public void testCreate() throws Exception { RADateRanges dateRanges = RADateRanges.create("2010-01-01:2010-01-10"); assertEquals(1, dateRanges.numRanges()); dateRanges = RADateRanges.create("2010-01-01:2010-01-10,2010-01-10:2010-01-20"); assertEquals(2, dateRanges.numRanges()); }