private DateRange toDateRange(String s, VR vr) { String[] range = splitRange(s); TimeZone tz = getTimeZone(); DatePrecision precision = new DatePrecision(); Date start = range[0] == null ? null : vr.toDate(range[0], tz, 0, false, null, precision); Date end = range[1] == null ? null : vr.toDate(range[1], tz, 0, true, null, precision); return new DateRange(start, end); }
private DateRange toDateRange(String da, String tm) { String[] darange = splitRange(da); String[] tmrange = splitRange(tm); DatePrecision precision = new DatePrecision(); return new DateRange( darange[0] == null ? null : VR.DT.toDate(tmrange[0] == null ? darange[0] : darange[0] + tmrange[0], tz, 0, false, null, precision ), darange[1] == null ? null : VR.DT.toDate(tmrange[1] == null ? darange[1] : darange[1] + tmrange[1], tz, 0, true, null, precision)); }
public Date[] getDates(String privateCreator, long tag, DatePrecisions precisions) { int daTag = (int) (tag >>> 32); int tmTag = (int) tag; String[] tm = getStrings(privateCreator, tmTag); if (tm == null || tm.length == 0) return getDates(daTag, precisions); String[] da = getStrings(privateCreator, daTag); if (da == null || da.length == 0) return DateUtils.EMPTY_DATES; Date[] dates = new Date[da.length]; precisions.precisions = new DatePrecision[da.length]; int i = 0; try { TimeZone tz = getTimeZone(); while (i < tm.length) dates[i++] = VR.DT.toDate(da[i] + tm[i], tz, 0, false, null, precisions.precisions[i] = new DatePrecision()); while (i < da.length) dates[i++] = VR.DA.toDate(da[i], tz, 0, false, null, precisions.precisions[i] = new DatePrecision()); } catch (IllegalArgumentException e) { LOG.info("Invalid value of {} DA or {} TM", TagUtils.toString(daTag), TagUtils.toString(tmTag)); dates = Arrays.copyOf(dates, i); } return dates; }
public Date getDate(String privateCreator, long tag, Date defVal, DatePrecision precision) { int daTag = (int) (tag >>> 32); int tmTag = (int) tag; String tm = getString(privateCreator, tmTag, VR.TM, null); if (tm == null) return getDate(daTag, defVal, precision); String da = getString(privateCreator, daTag, VR.DA, null); if (da == null) return defVal; try { return VR.DT.toDate(da + tm, getTimeZone(), 0, false, null, precision); } catch (IllegalArgumentException e) { LOG.info("Invalid value of {} DA or {} TM", TagUtils.toString(daTag), TagUtils.toString(tmTag)); return defVal; } }
public Date getDate(String privateCreator, int tag, VR vr, int valueIndex, Date defVal, DatePrecision precision) { int index = indexOf(privateCreator, tag); if (index < 0) return defVal; Object value = values[index]; if (value == Value.NULL) return defVal; if (vr == null) vr = vrs[index]; else updateVR(index, vr); if (!vr.isTemporalType()) { LOG.info("Attempt to access {} {} as date", TagUtils.toString(tag), vr); return defVal; } try { value = decodeStringValue(index); if (value == Value.NULL) return defVal; return vr.toDate(value, getTimeZone(), valueIndex, false, defVal, precision); } catch (IllegalArgumentException e) { LOG.info("Invalid value of {} {}", TagUtils.toString(tag), vr); return defVal; } }
if (dateRange != null) if (dateRange.contains( vr.toDate(val, getTimeZone(), 0, false, null, new DatePrecision()))) return true; else