return this; Partial partialRef = ref.getJodaTimePartial(); if (partialRef == null) { throw new UnsupportedOperationException("Cannot resolve if reftime is of class: " + ref.getClass());
return this; Partial partialRef = ref.getJodaTimePartial(); if (partialRef == null) { throw new UnsupportedOperationException("Cannot resolve if reftime is of class: " + ref.getClass());
@Override public SUTime.Time resolve(SUTime.Time t, int flags) { Partial p = (t != null)? t.getJodaTimePartial():null; if (p != null) { if (JodaTimeUtils.hasField(p, DateTimeFieldType.year())) { int year = p.get(DateTimeFieldType.year()); // TODO: If we knew location of article, can use that information to resolve holidays better Set<de.jollyday.Holiday> holidays = holidayManager.getHolidays(year); // Try to find this holiday for (de.jollyday.Holiday h:holidays) { if (h.getPropertiesKey().equals(base.getDescriptionPropertiesKey())) { return new SUTime.PartialTime(this, new Partial(h.getDate())); } } } } return this; }
public Instant getJodaTimeInstant() { Partial p = base; if (tod != null) { Partial p2 = tod.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (dow != null) { Partial p2 = dow.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (poy != null) { Partial p2 = poy.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } return JodaTimeUtils.getInstant(p); }
@Override public Instant getJodaTimeInstant() { Partial p = base; if (tod != null) { Partial p2 = tod.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (dow != null) { Partial p2 = dow.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (poy != null) { Partial p2 = poy.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } return JodaTimeUtils.getInstant(p); }
public Instant getJodaTimeInstant() { Partial p = base; if (tod != null) { Partial p2 = tod.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (dow != null) { Partial p2 = dow.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (poy != null) { Partial p2 = poy.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } return JodaTimeUtils.getInstant(p); }
private SUTime.Time findReferenceDate(List<TimeExpression> timeExpressions) { // Find first full date in this annotation with year, month, and day for (TimeExpression te:timeExpressions) { SUTime.Temporal t = te.getTemporal(); if (t instanceof SUTime.Time) { if (t.isGrounded()) { return t.getTime(); } else if (t instanceof SUTime.PartialTime) { if (JodaTimeUtils.hasYYYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime(); } else if (JodaTimeUtils.hasYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime().resolve(SUTime.getCurrentTime()).getTime(); } } } } return null; } }
private static SUTime.Time findReferenceDate(List<TimeExpression> timeExpressions) { // Find first full date in this annotation with year, month, and day for (TimeExpression te:timeExpressions) { SUTime.Temporal t = te.getTemporal(); if (t instanceof SUTime.Time) { if (t.isGrounded()) { return t.getTime(); } else if (t instanceof SUTime.PartialTime) { if (JodaTimeUtils.hasYYYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime(); } else if (JodaTimeUtils.hasYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime().resolve(SUTime.getCurrentTime()).getTime(); } } } } return null; }
public Partial getJodaTimePartial() { Partial p = null; if (base != null) { p = base.getJodaTimePartial(); } if (p == null && range != null && range.mid() != null) { p = range.mid().getJodaTimePartial(); } return p; }
@Override public Duration getGranularity() { StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getGranularity(); } Partial p = this.getJodaTimePartial(); return Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(p)); }
@Override public SUTime.Time resolve(SUTime.Time t, int flags) { Partial p = (t != null)? t.getJodaTimePartial():null; if (p != null) { if (JodaTimeUtils.hasField(p, DateTimeFieldType.year())) { int year = p.get(DateTimeFieldType.year()); SUTime.Time resolved = resolveWithYear(year); if (resolved != null) { return resolved; } } } return this; }
public Duration getGranularity() { StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getGranularity(); } Partial p = this.getJodaTimePartial(); return Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(p)); }
public Partial getJodaTimePartial() { Partial p = null; if (base != null) { p = base.getJodaTimePartial(); } if (p == null && range != null) { p = range.mid().getJodaTimePartial(); } return p; }
@Override public Partial getJodaTimePartial() { Partial p = null; if (base != null) { p = base.getJodaTimePartial(); } if (p == null && range != null && range.mid() != null) { p = range.mid().getJodaTimePartial(); } return p; }
public Time toTime(Time refTime, int flags) { Partial p = refTime.getJodaTimePartial(); if (p != null) {
@Override public Instant getJodaTimeInstant() { Partial p = base; if (tod != null) { Partial p2 = tod.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (dow != null) { Partial p2 = dow.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } if (poy != null) { Partial p2 = poy.getJodaTimePartial(); if (p2 != null && JodaTimeUtils.isCompatible(p, p2)) { p = JodaTimeUtils.combine(p, p2); } } return JodaTimeUtils.getInstant(p); }
private static SUTime.Time findReferenceDate(List<TimeExpression> timeExpressions) { // Find first full date in this annotation with year, month, and day for (TimeExpression te:timeExpressions) { SUTime.Temporal t = te.getTemporal(); if (t instanceof SUTime.Time) { if (t.isGrounded()) { return t.getTime(); } else if (t instanceof SUTime.PartialTime) { if (JodaTimeUtils.hasYYYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime(); } else if (JodaTimeUtils.hasYYMMDD(t.getTime().getJodaTimePartial())) { return t.getTime().resolve(SUTime.getCurrentTime()).getTime(); } } } } return null; }
@Override public SUTime.Time resolve(SUTime.Time t, int flags) { Partial p = (t != null)? t.getJodaTimePartial():null; if (p != null) { if (JodaTimeUtils.hasField(p, DateTimeFieldType.year())) { int year = p.get(DateTimeFieldType.year()); SUTime.Time resolved = resolveWithYear(year); if (resolved != null) { return resolved; } } } return this; }
@Override public Partial getJodaTimePartial() { Partial p = null; if (base != null) { p = base.getJodaTimePartial(); } if (p == null && range != null && range.mid() != null) { p = range.mid().getJodaTimePartial(); } return p; }
@Override public Duration getGranularity() { StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getGranularity(); } Partial p = this.getJodaTimePartial(); return Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(p)); }