if (resolvedThis != null) { if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) >= 0) { return PREV.apply(arg1, arg2);
if (resolvedThis != null) { if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) <= 0) { return NEXT.apply(arg1, arg2);
if (resolved.compareTo(ref) > 0) { Time t = (Time) this.prev(); if (t != null) { if (resolved.compareTo(ref) < 0) { Time t = (Time) this.next(); if (t != null) { if (resolved.compareTo(ref) > 0) { Time t = (Time) this.prev(); if (t != null) { resolved = Time.closest(ref, resolved, resolved2); } if (resolved.compareTo(ref) < 0) { Time t = (Time) this.next(); if (t != null) {
public Temporal apply(Temporal arg1, Temporal arg2, int flags) { if (arg1 == null) { return new RelativeTime(PREV_IMMEDIATE, arg2); } if (arg2 == null) { return arg1; } // Temporal arg2Prev = arg2.prev(); // if (arg1 == null || arg2Prev == null) { return arg2Prev; } if (arg1 instanceof Time) { Time t = (Time) arg1; if (arg2 instanceof Duration) { return ((Duration) arg2).toTime(t, flags | RESOLVE_TO_PAST); } else { // TODO: flags? Temporal resolvedThis = arg2.resolve(t, RESOLVE_TO_PAST); if (resolvedThis != null) { if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) >= 0) { return PREV.apply(arg1, arg2); } } } return resolvedThis; } } else { throw new UnsupportedOperationException("PREV_IMMEDIATE not implemented for arg1=" + arg1.getClass() + ", arg2=" + arg2.getClass()); } } },
public Temporal apply(Temporal arg1, Temporal arg2, int flags) { if (arg1 == null) { return new RelativeTime(NEXT_IMMEDIATE, arg2); } if (arg2 == null) { return arg1; } // Temporal arg2Next = arg2.next(); // if (arg1 == null || arg2Next == null) { return arg2Next; } if (arg1 instanceof Time) { Time t = (Time) arg1; if (arg2 instanceof Duration) { return ((Duration) arg2).toTime(t, flags | RESOLVE_TO_FUTURE); } else { // TODO: flags? Temporal resolvedThis = arg2.resolve(t, RESOLVE_TO_FUTURE); if (resolvedThis != null) { if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) <= 0) { return NEXT.apply(arg1, arg2); } } } return resolvedThis; } } else { throw new UnsupportedOperationException("NEXT_IMMEDIATE not implemented for arg1=" + arg1.getClass() + ", arg2=" + arg2.getClass()); } } },
public static Time max(Time t1, Time t2) { if (t1 == null) return t2; if (t2 == null) return t1; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c >= 0) ? t1 : t2; } return t2; }
@Override public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }
public static Duration distance(Time t1, Time t2) { if (t1.compareTo(t2) < 0) { return difference(t1,t2); } else { return difference(t2,t1); } }
public static Time max(Time t1, Time t2) { if (t1 == null) return t2; if (t2 == null) return t1; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c >= 0) ? t1 : t2; } return t2; }
public static Time min(Time t1, Time t2) { if (t2 == null) return t1; if (t1 == null) return t2; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c < 0) ? t1 : t2; } return t1; }
public static Time min(Time t1, Time t2) { if (t2 == null) return t1; if (t1 == null) return t2; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c < 0) ? t1 : t2; } return t1; }
public static Time min(Time t1, Time t2) { if (t2 == null) return t1; if (t1 == null) return t2; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c < 0) ? t1 : t2; } return t1; }
public static Duration distance(Time t1, Time t2) { if (t1.compareTo(t2) < 0) { return difference(t1,t2); } else { return difference(t2,t1); } }
public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }
public static Time max(Time t1, Time t2) { if (t1 == null) return t2; if (t2 == null) return t1; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c >= 0) ? t1 : t2; } return t2; }
@Override public int compareTo(Time t) { if (this.base != null) return (this.base.compareTo(t)); if (this.range != null) { if (this.range.begin() != null && this.range.begin().compareTo(t) > 0) return 1; else if (this.range.end() != null && this.range.end().compareTo(t) < 0) return -1; else return this.range.getTime().compareTo(t); } return 0; }
public static Time max(Time t1, Time t2) { if (t1 == null) return t2; if (t2 == null) return t1; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c >= 0) ? t1 : t2; } return t2; }
public static Time min(Time t1, Time t2) { if (t2 == null) return t1; if (t1 == null) return t2; if (t1.isComparable(t2)) { int c = t1.compareTo(t2); return (c < 0) ? t1 : t2; } return t1; }
public static Duration distance(Time t1, Time t2) { if (t1.compareTo(t2) < 0) { return difference(t1,t2); } else { return difference(t2,t1); } }