if (resolvedGranularity != null && refGranularity != null && resolvedGranularity.compareTo(refGranularity) >= 0) { if ((flags & RESOLVE_TO_PAST) != 0) { if (resolved.compareTo(ref) > 0) {
public static Pair<PartialTime, PartialTime> getCompatible(PartialTime t1, PartialTime t2) { // Incompatible timezones if (t1.dateTimeZone != null && t2.dateTimeZone != null && !t1.dateTimeZone.equals(t2.dateTimeZone)) return null; if (t1.isCompatible(t2)) return Pair.makePair(t1,t2); if (t1.uncertaintyGranularity != null && t2.uncertaintyGranularity == null) { if (t1.uncertaintyGranularity.compareTo(t2.getDuration()) > 0) { // Drop the uncertain fields from t1 Duration d = t1.uncertaintyGranularity; PartialTime t1b = t1.reduceGranularityTo(d); if (t1b.isCompatible(t2)) return Pair.makePair(t1b,t2); } } else if (t1.uncertaintyGranularity == null && t2.uncertaintyGranularity != null) { if (t2.uncertaintyGranularity.compareTo(t1.getDuration()) > 0) { // Drop the uncertain fields from t2 Duration d = t2.uncertaintyGranularity; PartialTime t2b = t2.reduceGranularityTo(d); if (t1.isCompatible(t2b)) return Pair.makePair(t1,t2b); } } else if (t1.uncertaintyGranularity != null && t2.uncertaintyGranularity != null) { Duration d1 = Duration.max(t1.uncertaintyGranularity, t2.getDuration()); Duration d2 = Duration.max(t2.uncertaintyGranularity, t1.getDuration()); PartialTime t1b = t1.reduceGranularityTo(d1); PartialTime t2b = t2.reduceGranularityTo(d2); if (t1b.isCompatible(t2b)) return Pair.makePair(t1b,t2b); } return null; }
public Duration getDuration() { /* TimeLabel tl = getTimeLabel(); if (tl != null) { return tl.getDuration(); } */ StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getDuration(); } Duration bd = (base != null) ? Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(base)) : null; if (tod != null) { Duration d = tod.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (dow != null) { Duration d = dow.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (poy != null) { Duration d = poy.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } return bd; }
public Duration getDuration() { TimeLabel tl = getTimeLabel(); if (tl != null) { return tl.getDuration(); } TimeLabelType tlt = getTimeLabelType(); if (tlt != null) { return tlt.getDuration(); } Duration bd = (base != null) ? Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(base)) : null; if (tod != null) { Duration d = tod.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (dow != null) { Duration d = dow.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (poy != null) { Duration d = poy.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } return bd; }
@Override public Duration getDuration() { /* TimeLabel tl = getTimeLabel(); if (tl != null) { return tl.getDuration(); } */ StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getDuration(); } Duration bd = (base != null) ? Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(base)) : null; if (tod != null) { Duration d = tod.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (dow != null) { Duration d = dow.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (poy != null) { Duration d = poy.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } return bd; }
public Duration intersect(Duration d) { if (d == null || d == DURATION_UNKNOWN) return this; int cmp = compareTo(d); if (cmp < 0) { return this; } else { return d; } }
public static Duration max(Duration d1, Duration d2) { if (d1 == null) return d2; if (d2 == null) return d1; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c >= 0) ? d1 : d2; } return d2; }
public Duration intersect(Duration d) { if (d == null || d == DURATION_UNKNOWN) return this; int cmp = compareTo(d); if (cmp < 0) { return this; } else { return d; } }
public static Duration min(Duration d1, Duration d2) { if (d2 == null) return d1; if (d1 == null) return d2; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c < 0) ? d1 : d2; } return d1; }
public static Duration max(Duration d1, Duration d2) { if (d1 == null) return d2; if (d2 == null) return d1; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c >= 0) ? d1 : d2; } return d2; } }
public static Duration min(Duration d1, Duration d2) { if (d2 == null) return d1; if (d1 == null) return d2; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c < 0) ? d1 : d2; } return d1; }
public static Duration min(Duration d1, Duration d2) { if (d2 == null) return d1; if (d1 == null) return d2; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c < 0) ? d1 : d2; } return d1; }
public Duration intersect(Duration d) { if (d == null || d == DURATION_UNKNOWN) return this; int cmp = compareTo(d); if (cmp < 0) { return this; } else { return d; } }
public static Duration max(Duration d1, Duration d2) { if (d1 == null) return d2; if (d2 == null) return d1; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c >= 0) ? d1 : d2; } return d2; }
public static Pair<PartialTime, PartialTime> getCompatible(PartialTime t1, PartialTime t2) { // Incompatible timezones if (t1.dateTimeZone != null && t2.dateTimeZone != null && !t1.dateTimeZone.equals(t2.dateTimeZone)) return null; if (t1.isCompatible(t2)) return Pair.makePair(t1,t2); if (t1.uncertaintyGranularity != null && t2.uncertaintyGranularity == null) { if (t1.uncertaintyGranularity.compareTo(t2.getDuration()) > 0) { // Drop the uncertain fields from t1 Duration d = t1.uncertaintyGranularity; PartialTime t1b = t1.reduceGranularityTo(d); if (t1b.isCompatible(t2)) return Pair.makePair(t1b,t2); } } else if (t1.uncertaintyGranularity == null && t2.uncertaintyGranularity != null) { if (t2.uncertaintyGranularity.compareTo(t1.getDuration()) > 0) { // Drop the uncertain fields from t2 Duration d = t2.uncertaintyGranularity; PartialTime t2b = t2.reduceGranularityTo(d); if (t1.isCompatible(t2b)) return Pair.makePair(t1,t2b); } } else if (t1.uncertaintyGranularity != null && t2.uncertaintyGranularity != null) { Duration d1 = Duration.max(t1.uncertaintyGranularity, t2.getDuration()); Duration d2 = Duration.max(t2.uncertaintyGranularity, t1.getDuration()); PartialTime t1b = t1.reduceGranularityTo(d1); PartialTime t2b = t2.reduceGranularityTo(d2); if (t1b.isCompatible(t2b)) return Pair.makePair(t1b,t2b); } return null; }
@Override public Duration getDuration() { /* TimeLabel tl = getTimeLabel(); if (tl != null) { return tl.getDuration(); } */ StandardTemporalType tlt = getStandardTemporalType(); if (tlt != null) { return tlt.getDuration(); } Duration bd = (base != null) ? Duration.getDuration(JodaTimeUtils.getJodaTimePeriod(base)) : null; if (tod != null) { Duration d = tod.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (dow != null) { Duration d = dow.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } if (poy != null) { Duration d = poy.getDuration(); return (bd.compareTo(d) < 0) ? bd : d; } return bd; }
public static Duration max(Duration d1, Duration d2) { if (d1 == null) return d2; if (d2 == null) return d1; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c >= 0) ? d1 : d2; } return d2; }
public static Duration min(Duration d1, Duration d2) { if (d2 == null) return d1; if (d1 == null) return d2; if (d1.isComparable(d2)) { int c = d1.compareTo(d2); return (c < 0) ? d1 : d2; } return d1; }
public Duration intersect(Duration d) { if (d == null || d == DURATION_UNKNOWN) return this; int cmp = compareTo(d); if (cmp < 0) { return this; } else { return d; } }