From b4ceef286d9c3c204463c4beafef55adce8024e9 Mon Sep 17 00:00:00 2001 From: perceptron8 Date: Sat, 10 Dec 2022 23:03:08 +0100 Subject: [PATCH] Rewrite `Interval.parse(CharSequence)` --- .../java/org/threeten/extra/Interval.java | 152 ++++++++++-------- .../java/org/threeten/extra/TestInterval.java | 40 ++++- 2 files changed, 124 insertions(+), 68 deletions(-) diff --git a/src/main/java/org/threeten/extra/Interval.java b/src/main/java/org/threeten/extra/Interval.java index f7b2a8cf..ad45b4d3 100644 --- a/src/main/java/org/threeten/extra/Interval.java +++ b/src/main/java/org/threeten/extra/Interval.java @@ -40,7 +40,8 @@ import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; -import java.time.temporal.TemporalAccessor; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAmount; import java.util.Objects; import org.joda.convert.FromString; @@ -78,6 +79,11 @@ public final class Interval */ private static final long serialVersionUID = 8375285238652L; + /** + * Leap year cycle length. + */ + private static final Duration leapYearCycleLength = Duration.ofHours(3506328L); + /** * The start instant (inclusive). */ @@ -156,12 +162,14 @@ public static Interval endingAt(Instant endExclusive) { * Obtains an instance of {@code Interval} from a text string such as * {@code 2007-12-03T10:15:30Z/2007-12-04T10:15:30Z}, where the end instant is exclusive. *

- * The string must consist of one of the following four formats: + * The string must consist of one of the following five formats: *