@Test public void testParseExpressionRelativeToHL7DateTime() throws Exception { IntervalOfTime dateRange = IntervalOfTimeFormat.parse("2012+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); assertThat(dateRange.isLowClosed(), is(true)); assertThat(dateRange.isHighClosed(), is(true)); dateRange = IntervalOfTimeFormat.parse("201205+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012, 5).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); dateRange = IntervalOfTimeFormat.parse("20120524+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012, 5, 24).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); dateRange = IntervalOfTimeFormat.parse("2012052412+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012, 5, 24, 12).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); dateRange = IntervalOfTimeFormat.parse("201205241200+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012, 5, 24, 12, 0).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); dateRange = IntervalOfTimeFormat.parse("20120524120000+1Y"); assertThat(dateRange.getLow(), is(new PointInTime(2012, 5, 24, 12, 0, 0).addYears(1).promote().getLow())); assertThat(dateRange.getHigh(), is(IntervalOfTime.today().toClosed().getHigh())); }
public static IntervalOfTime parse(String text) { return getDefault().parseInterval(text); }
IntervalOfTimeFormat { public static IntervalOfTime parse(String text) { return getDefault().parseInterval(text); } }
IntervalOfTimeFormat { public static IntervalOfTime parse(String text) { return getDefault().parseInterval(text); }  }
IntervalOfTimeFormat { public static IntervalOfTime parse(String text) { return getDefault().parseInterval(text); }  static IntervalOfTimeFormatter getDefault(); static IntervalOfTimeFormatter intervalForm(); static IntervalOfTime parse(String text); static IntervalOfTime parseIntervalForm(String text); static String print(IntervalOfTime text); static String printIntervalForm(IntervalOfTime text); static String toString(IntervalOfTime text); }
IntervalOfTimeFormat { public static IntervalOfTime parse(String text) { return getDefault().parseInterval(text); }  static IntervalOfTimeFormatter getDefault(); static IntervalOfTimeFormatter intervalForm(); static IntervalOfTime parse(String text); static IntervalOfTime parseIntervalForm(String text); static String print(IntervalOfTime text); static String printIntervalForm(IntervalOfTime text); static String toString(IntervalOfTime text);  }