@Override boolean isBefore(PlainDate t1, PlainDate t2) { return t1.isBefore(t2); }
@Override public boolean isBefore(PlainDate temporal) { return this.end.getTemporal().isBefore(temporal); }
@Override public boolean isBefore(PlainDate temporal) { return this.end.getTemporal().isBefore(temporal); }
@Override public boolean isBefore(PlainDate temporal) { return this.end.getTemporal().isBefore(temporal); }
/** * <p>Defines the temporal order of date and time as natural order. </p> * * <p>The comparison is consistent with {@code equals()}. </p> * * @see #isBefore(PlainTimestamp) * @see #isAfter(PlainTimestamp) */ /*[deutsch] * <p>Definiert eine natürliche Ordnung, die auf der zeitlichen * Position basiert. </p> * * <p>Der Vergleich ist konsistent mit {@code equals()}. </p> * * @see #isBefore(PlainTimestamp) * @see #isAfter(PlainTimestamp) */ @Override public int compareTo(PlainTimestamp timestamp) { if (this.date.isAfter(timestamp.date)) { return 1; } else if (this.date.isBefore(timestamp.date)) { return -1; } return this.time.compareTo(timestamp.time); }
@Override public boolean contains(PlainDate temporal) { return (!temporal.isBefore(this.start.getTemporal())) && !temporal.isAfter(this.end.getTemporal()); }
@Override public long between( PlainDate start, PlainDate end ) { if (start.isSimultaneous(end)) { return 0L; } long count = 0; boolean negative = start.isAfter(end); if (negative) { do { end = end.plus(1, CalendarUnit.DAYS); if (!model.test(end)) { count++; } } while (end.isBefore(start)); } else { do { start = start.plus(1, CalendarUnit.DAYS); if (!model.test(start)) { count++; } } while (start.isBefore(end)); } return negative ? -count : count; } };
private long monthDelta( PlainDate start, PlainDate end ) { long amount = (end.getEpochMonths() - start.getEpochMonths()); if ( (this.policy == POLICY_KEEPING_LAST_DATE) || (this.policy == POLICY_END_OF_MONTH) || (this.policy == POLICY_JODA_METRIC) ) { CalendarUnit u = CalendarUnit.MONTHS; if ((amount > 0) && PlainDate.doAdd(u, start, amount, this.policy).isAfter(end)) { amount--; } else if ((amount < 0) && PlainDate.doAdd(u, start, amount, this.policy).isBefore(end)) { amount++; } } else { if ((amount > 0) && (end.getDayOfMonth() < start.getDayOfMonth())) { amount--; } else if ((amount < 0) && (end.getDayOfMonth() > start.getDayOfMonth())) { amount++; } } return amount; }
@Override public boolean isBefore(ChronoInterval<PlainDate> other) { if (other.getStart().isInfinite()) { return false; } PlainDate endA = this.getEnd().getTemporal(); PlainDate startB = other.getStart().getTemporal(); if (other.getStart().isOpen()) { if (startB.equals(PlainDate.axis().getMaximum())) { return true; } startB = startB.plus(1, CalendarUnit.DAYS); } return endA.isBefore(startB); }
@Override public boolean contains(ChronoInterval<PlainDate> other) { if (!other.isFinite()) { return false; } PlainDate startA = this.getStart().getTemporal(); PlainDate startB = other.getStart().getTemporal(); if (other.getStart().isOpen()) { if (startB.equals(PlainDate.axis().getMaximum())) { return false; } startB = startB.plus(1, CalendarUnit.DAYS); } if (startA.isAfter(startB)) { return false; } PlainDate endA = this.getEnd().getTemporal(); PlainDate endB = other.getEnd().getTemporal(); if (other.getEnd().isOpen()) { if (startB.isSimultaneous(endB)) { return !startB.isAfter(endA); } else if (endB.equals(PlainDate.axis().getMinimum())) { return false; } endB = endB.minus(1, CalendarUnit.DAYS); } return !endA.isBefore(endB); }