/** * Is the transition local time midnight at the end of day. * <p> * The transition may be represented as occurring at 24:00. * * @return whether a local time of midnight is at the start or end of the day */ public boolean isMidnightEndOfDay() { return adjustDays == 1 && time.equals(LocalTime.MIDNIGHT); }
/** * Is the transition local time midnight at the end of day. * <p> * The transition may be represented as occurring at 24:00. * * @return whether a local time of midnight is at the start or end of the day */ public boolean isMidnightEndOfDay() { return adjustDays == 1 && time.equals(LocalTime.MIDNIGHT); }
/** * Checks if this date-time is equal to another date-time. * <p> * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same. * Only objects of type {@code LocalDateTime} are compared, other types return false. * * @param obj the object to check, null returns false * @return true if this is equal to the other date-time */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof LocalDateTime) { LocalDateTime other = (LocalDateTime) obj; return date.equals(other.date) && time.equals(other.time); } return false; }
/** * Checks if this date-time is equal to another date-time. * <p> * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same. * Only objects of type {@code LocalDateTime} are compared, other types return false. * * @param obj the object to check, null returns false * @return true if this is equal to the other date-time */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof LocalDateTime) { LocalDateTime other = (LocalDateTime) obj; return date.equals(other.date) && time.equals(other.time); } return false; }
/** * Checks if this time is equal to another time. * <p> * The comparison is based on the local-time and the offset. * To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}. * <p> * Only objects of type {@code OffsetTime} are compared, other types return false. * To compare the underlying local time of two {@code TemporalAccessor} instances, * use {@link ChronoField#NANO_OF_DAY} as a comparator. * * @param obj the object to check, null returns false * @return true if this is equal to the other time */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof OffsetTime) { OffsetTime other = (OffsetTime) obj; return time.equals(other.time) && offset.equals(other.offset); } return false; }
/** * Checks if this time is equal to another time. * <p> * The comparison is based on the local-time and the offset. * To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}. * <p> * Only objects of type {@code OffsetTime} are compared, other types return false. * To compare the underlying local time of two {@code TemporalAccessor} instances, * use {@link ChronoField#NANO_OF_DAY} as a comparator. * * @param obj the object to check, null returns false * @return true if this is equal to the other time */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof OffsetTime) { OffsetTime other = (OffsetTime) obj; return time.equals(other.time) && offset.equals(other.offset); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof ScalarTime)) { return false; } return this.getValue().equals(((ScalarTime) obj).getValue()); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof KVTime)) { return false; } return this.getValue().equals(((KVTime) obj).getValue()); }
/** * Checks if this object equals another. * <p> * The entire state of the object is compared. * * @param otherRule the other object to compare to, null returns false * @return true if equal */ @Override public boolean equals(Object otherRule) { if (otherRule == this) { return true; } if (otherRule instanceof ZoneOffsetTransitionRule) { ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule) otherRule; return month == other.month && dom == other.dom && dow == other.dow && timeDefinition == other.timeDefinition && adjustDays == other.adjustDays && time.equals(other.time) && standardOffset.equals(other.standardOffset) && offsetBefore.equals(other.offsetBefore) && offsetAfter.equals(other.offsetAfter); } return false; }
/** * Checks if this object equals another. * <p> * The entire state of the object is compared. * * @param otherRule the other object to compare to, null returns false * @return true if equal */ @Override public boolean equals(Object otherRule) { if (otherRule == this) { return true; } if (otherRule instanceof ZoneOffsetTransitionRule) { ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule) otherRule; return month == other.month && dom == other.dom && dow == other.dow && timeDefinition == other.timeDefinition && adjustDays == other.adjustDays && time.equals(other.time) && standardOffset.equals(other.standardOffset) && offsetBefore.equals(other.offsetBefore) && offsetAfter.equals(other.offsetAfter); } return false; }
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) { throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) { throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) { throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) { throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
@Test public void testTimeText() throws Exception { // convert to text String jsr310ResultText = DBToolsThreeTenFormatter.localTimeToDBString(jsr301Time); // String jodaResultText = DBToolsDateFormatter.dateTimeToDBString(jodaDateTime); assertEquals(TEXT_TIME, jsr310ResultText); // assertEquals(TEXT_TIMESTAMP, jodaResultText); // convert back to object LocalTime resultJsr310Time = DBToolsThreeTenFormatter.dbStringToLocalTime(jsr310ResultText); // DateTime resultJodaDateTime = DBToolsDateFormatter.dbStringToDateTime(jodaResultText); assertNotNull(resultJsr310Time); assertTrue(jsr301Time.equals(resultJsr310Time)); // assertNotNull(resultJodaDateTime); // assertTrue(jodaDateTime.isEqual(resultJodaDateTime)); } }