/** * Extracts interval endpoint values from an object of this converter's type, and sets them into * the given ReadWritableInterval. * * @param writableInterval interval to get modified, not null * @param object the object to convert, must not be null * @param chrono the chronology to use, may be null * @throws ClassCastException if the object is invalid */ public void setInto(ReadWritableInterval writableInterval, Object object, Chronology chrono) { ReadableInterval input = (ReadableInterval) object; writableInterval.setInterval(input); if (chrono != null) { writableInterval.setChronology(chrono); } else { writableInterval.setChronology(input.getChronology()); } }
/** * Compares this object with the specified object for equality based on start and end millis plus * the chronology. All ReadableInterval instances are accepted. * * <p>To compare the duration of two time intervals, use {@link #toDuration()} to get the * durations and compare those. * * @param readableInterval a readable interval to check against * @return true if the start and end millis are equal */ public boolean equals(Object readableInterval) { if (this == readableInterval) { return true; } if (readableInterval instanceof ReadableInterval == false) { return false; } ReadableInterval other = (ReadableInterval) readableInterval; return getStartMillis() == other.getStartMillis() && getEndMillis() == other.getEndMillis() && FieldUtils.equals(getChronology(), other.getChronology()); }