if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) >= 0) { return PREV.apply(arg1, arg2);
public int hashCode() { int result = base != null ? base.hashCode() : 0; result = 31 * result + (tempOp != null ? tempOp.hashCode() : 0); result = 31 * result + (tempArg != null ? tempArg.hashCode() : 0); result = 31 * result + opFlags; return result; }
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()); } } },
if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) >= 0) { return PREV.apply(arg1, arg2);
if (resolvedThis instanceof Time) { if (((Time) resolvedThis).compareTo(t) <= 0) { return NEXT.apply(arg1, arg2);
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 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) { return apply(arg1, arg2, 0); }
public Temporal next() { Duration per = getPeriod(); if (per != null) { if (this instanceof Duration) { return new RelativeTime(new RelativeTime(TemporalOp.THIS, this, DUR_RESOLVE_TO_AS_REF), TemporalOp.OFFSET, per); } else { // return new RelativeTime(new RelativeTime(TemporalOp.THIS, this), // TemporalOp.OFFSET, per); return TemporalOp.OFFSET.apply(this, per); } } return null; }
public Temporal next() { Duration per = getPeriod(); if (per != null) { if (this instanceof Duration) { return new RelativeTime(new RelativeTime(TemporalOp.THIS, this, DUR_RESOLVE_TO_AS_REF), TemporalOp.OFFSET, per); } else { // return new RelativeTime(new RelativeTime(TemporalOp.THIS, this), // TemporalOp.OFFSET, per); return TemporalOp.OFFSET.apply(this, per); } } return null; }
public Temporal prev() { Duration per = getPeriod(); if (per != null) { if (this instanceof Duration) { return new RelativeTime(new RelativeTime(TemporalOp.THIS, this, DUR_RESOLVE_FROM_AS_REF), TemporalOp.OFFSET, per.multiplyBy(-1)); } else { // return new RelativeTime(new RelativeTime(TemporalOp.THIS, this), // TemporalOp.OFFSET, per.multiplyBy(-1)); return TemporalOp.OFFSET.apply(this, per.multiplyBy(-1)); } } return null; }
public Temporal prev() { Duration per = getPeriod(); if (per != null) { if (this instanceof Duration) { return new RelativeTime(new RelativeTime(TemporalOp.THIS, this, DUR_RESOLVE_FROM_AS_REF), TemporalOp.OFFSET, per.multiplyBy(-1)); } else { // return new RelativeTime(new RelativeTime(TemporalOp.THIS, this), // TemporalOp.OFFSET, per.multiplyBy(-1)); return TemporalOp.OFFSET.apply(this, per.multiplyBy(-1)); } } return null; }
public Temporal apply(Temporal arg1, Temporal arg2) { return apply(arg1, arg2, 0); }
public Temporal prev() { Duration per = getPeriod(); if (per != null) { if (this instanceof Duration) { return new RelativeTime(new RelativeTime(TemporalOp.THIS, this, DUR_RESOLVE_FROM_AS_REF), TemporalOp.OFFSET, per.multiplyBy(-1)); } else { // return new RelativeTime(new RelativeTime(TemporalOp.THIS, this), // TemporalOp.OFFSET, per.multiplyBy(-1)); return TemporalOp.OFFSET.apply(this, per.multiplyBy(-1)); } } return null; }