/** * Is this time interval before the specified instant. * * <p>Intervals are inclusive of the start instant and exclusive of the end. * * @param instant the instant to compare to, null means now * @return true if this time interval is before the instant */ public boolean isBefore(ReadableInstant instant) { if (instant == null) { return isBeforeNow(); } return isBefore(instant.getMillis()); }
/** * Is this time interval after the specified instant. * * <p>Intervals are inclusive of the start instant and exclusive of the end. * * @param instant the instant to compare to, null means now * @return true if this time interval is after the instant */ public boolean isAfter(ReadableInstant instant) { if (instant == null) { return isAfterNow(); } return isAfter(instant.getMillis()); }
/** * Does this time interval contain the specified instant. * * <p>Non-zero duration intervals are inclusive of the start instant and exclusive of the end. A * zero duration interval cannot contain anything. * * <p>For example: * * <pre> * [09:00 to 10:00) contains 08:59 = false (before start) * [09:00 to 10:00) contains 09:00 = true * [09:00 to 10:00) contains 09:59 = true * [09:00 to 10:00) contains 10:00 = false (equals end) * [09:00 to 10:00) contains 10:01 = false (after end) * * [14:00 to 14:00) contains 14:00 = false (zero duration contains nothing) * </pre> * * Passing in a <code>null</code> parameter will have the same effect as calling {@link * #containsNow()}. * * @param instant the instant, null means now * @return true if this time interval contains the instant */ public boolean contains(ReadableInstant instant) { if (instant == null) { return containsNow(); } return contains(instant.getMillis()); }