| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getCount()
Obtains the count of recurrent intervals.
|
int |
hashCode() |
Stream<I> |
intervalStream()
Obtains an ordered stream of recurrent intervals.
|
boolean |
isBackwards()
Queries if the resulting interval stream describes a backwards running sequence.
|
boolean |
isEmpty()
Queries if the count of intervals is zero.
|
boolean |
isInfinite()
Queries if the count of intervals is unlimited.
|
Iterator<I> |
iterator() |
static IsoRecurrence<MomentInterval> |
of(int count,
Duration<?> duration,
Moment end,
ZonalOffset offset)
Creates a recurrent backward sequence of moment intervals having given duration.
|
static IsoRecurrence<TimestampInterval> |
of(int count,
Duration<?> duration,
PlainTimestamp end)
Creates a recurrent backward sequence of timestamp intervals having given duration.
|
static IsoRecurrence<DateInterval> |
of(int count,
Duration<? extends IsoDateUnit> duration,
PlainDate end)
Creates a recurrent backward sequence of date intervals having given duration.
|
static IsoRecurrence<MomentInterval> |
of(int count,
Moment start,
Duration<?> duration,
ZonalOffset offset)
Creates a recurrent sequence of moment intervals having given duration.
|
static IsoRecurrence<MomentInterval> |
of(int count,
Moment start,
Moment end,
ZonalOffset offset)
Creates a recurrent sequence of moment intervals having the duration
of first timestamp interval in years, months, days, hours, minutes, seconds and nanoseconds.
|
static IsoRecurrence<DateInterval> |
of(int count,
PlainDate start,
Duration<? extends IsoDateUnit> duration)
Creates a recurrent sequence of date intervals having given duration.
|
static IsoRecurrence<DateInterval> |
of(int count,
PlainDate start,
PlainDate end)
Creates a recurrent sequence of date intervals having the duration
of first interval in years, months and days.
|
static IsoRecurrence<TimestampInterval> |
of(int count,
PlainTimestamp start,
Duration<?> duration)
Creates a recurrent sequence of timestamp intervals having given duration.
|
static IsoRecurrence<TimestampInterval> |
of(int count,
PlainTimestamp start,
PlainTimestamp end)
Creates a recurrent sequence of timestamp intervals having the duration
of first timestamp interval in years, months, days, hours, minutes, seconds and nanoseconds.
|
static IsoRecurrence<DateInterval> |
parseDateIntervals(String iso)
Parses a string like "R5/2016-04-01/2016-04-30" or "R5/2016-04-01/P1M"
to a sequence of recurrent date intervals.
|
static IsoRecurrence<MomentInterval> |
parseMomentIntervals(String iso)
Parses a string like "R5/2016-04-01T10:45Z/30T23:59"
to a sequence of recurrent moment intervals.
|
static IsoRecurrence<TimestampInterval> |
parseTimestampIntervals(String iso)
Parses a string like "R5/2016-04-01T10:45/2016-04-30T23:59"
to a sequence of recurrent timestamp intervals.
|
String |
toString()
Yields a representation in extended ISO-format.
|
IsoRecurrence<I> |
withCount(int count)
Creates a copy with given modified count.
|
IsoRecurrence<I> |
withInfiniteCount()
Creates a copy with an unlimited count of recurrent intervals.
|
forEach, spliteratorpublic static IsoRecurrence<DateInterval> of(int count, PlainDate start, Duration<? extends IsoDateUnit> duration)
Creates a recurrent sequence of date intervals having given duration.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)duration - represents the duration of every repeating intervalIllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<DateInterval> of(int count, Duration<? extends IsoDateUnit> duration, PlainDate end)
Creates a recurrent backward sequence of date intervals having given duration.
count - the count of repeating intervals (>= 0)duration - represents the negative duration of every repeating intervalend - denotes the end of first interval (inclusive)IllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<DateInterval> of(int count, PlainDate start, PlainDate end)
Creates a recurrent sequence of date intervals having the duration of first interval in years, months and days.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)end - denotes the end of first interval (inclusive)IllegalArgumentException - if the count is negative or if start is not before endpublic static IsoRecurrence<TimestampInterval> of(int count, PlainTimestamp start, Duration<?> duration)
Creates a recurrent sequence of timestamp intervals having given duration.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)duration - represents the duration of every repeating intervalIllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<TimestampInterval> of(int count, Duration<?> duration, PlainTimestamp end)
Creates a recurrent backward sequence of timestamp intervals having given duration.
count - the count of repeating intervals (>= 0)duration - represents the negative duration of every repeating intervalend - denotes the end of first interval (exclusive)IllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<TimestampInterval> of(int count, PlainTimestamp start, PlainTimestamp end)
Creates a recurrent sequence of timestamp intervals having the duration of first timestamp interval in years, months, days, hours, minutes, seconds and nanoseconds.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)end - denotes the end of first interval (exclusive)IllegalArgumentException - if the count is negative or if start is not before endpublic static IsoRecurrence<MomentInterval> of(int count, Moment start, Duration<?> duration, ZonalOffset offset)
Creates a recurrent sequence of moment intervals having given duration.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)duration - represents the duration of every repeating intervaloffset - time zone offset in full minutesIllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<MomentInterval> of(int count, Duration<?> duration, Moment end, ZonalOffset offset)
Creates a recurrent backward sequence of moment intervals having given duration.
count - the count of repeating intervals (>= 0)duration - represents the negative duration of every repeating intervalend - denotes the end of first interval (exclusive)offset - time zone offset in full minutesIllegalArgumentException - if the count is negative or the duration is not positivepublic static IsoRecurrence<MomentInterval> of(int count, Moment start, Moment end, ZonalOffset offset)
Creates a recurrent sequence of moment intervals having the duration of first timestamp interval in years, months, days, hours, minutes, seconds and nanoseconds.
count - the count of repeating intervals (>= 0)start - denotes the start of first interval (inclusive)end - denotes the end of first interval (exclusive)offset - time zone offset in full minutesIllegalArgumentException - if the count is negative or if start is not before endpublic int getCount()
Obtains the count of recurrent intervals.
-1 if infinitepublic IsoRecurrence<I> withCount(int count)
Creates a copy with given modified count.
count - non-negative count of recurrent intervalsIllegalArgumentException - if the argument is negativepublic IsoRecurrence<I> withInfiniteCount()
Creates a copy with an unlimited count of recurrent intervals.
This method mainly exists to satisfy the requirements of ISO-8601. However: Special care must be taken to avoid infinite loops or streams.
public boolean isBackwards()
Queries if the resulting interval stream describes a backwards running sequence.
public boolean isEmpty()
Queries if the count of intervals is zero.
public boolean isInfinite()
Queries if the count of intervals is unlimited.
public static IsoRecurrence<DateInterval> parseDateIntervals(String iso) throws ParseException
Parses a string like "R5/2016-04-01/2016-04-30" or "R5/2016-04-01/P1M" to a sequence of recurrent date intervals.
iso - canonical representation of recurrent date intervalsParseException - in any case of inconsistenciespublic static IsoRecurrence<TimestampInterval> parseTimestampIntervals(String iso) throws ParseException
Parses a string like "R5/2016-04-01T10:45/2016-04-30T23:59" to a sequence of recurrent timestamp intervals.
Supported ISO-formats for timestamp parts are Iso8601Format.BASIC_DATE_TIME
and Iso8601Format.EXTENDED_DATE_TIME. A duration component will be parsed
by Duration.parsePeriod(String).
iso - canonical representation of recurrent intervalsParseException - in any case of inconsistenciespublic static IsoRecurrence<MomentInterval> parseMomentIntervals(String iso) throws ParseException
Parses a string like "R5/2016-04-01T10:45Z/30T23:59" to a sequence of recurrent moment intervals.
Supported ISO-formats for moment parts are Iso8601Format.BASIC_DATE_TIME_OFFSET
and Iso8601Format.EXTENDED_DATE_TIME_OFFSET. A duration component will be parsed
by Duration.parsePeriod(String).
iso - canonical representation of recurrent intervalsParseException - in any case of inconsistenciespublic String toString()
Yields a representation in extended ISO-format.
Examples:
System.out.println(
IsoRecurrence.of(5, PlainDate.of(2016, 8, 12), Duration.of(3, CalendarUnit.WEEKS));
// R5/2016-08-12/P3W
System.out.println(
IsoRecurrence.of(0, PlainTimestamp.of(2016, 8, 12, 10, 45), PlainTimestamp.of(2016, 8, 12, 12, 0)
.withInfiniteCount());
// R/2016-08-12T10:45/2016-08-12T12:00
public Stream<I> intervalStream()
Obtains an ordered stream of recurrent intervals.
Spliterator.DISTINCT,
Spliterator.IMMUTABLE,
Spliterator.NONNULL,
Spliterator.ORDERED,
Spliterator.SIZED,
Spliterator.SUBSIZEDCopyright © 2014–2021. All rights reserved.