public abstract class DayRanges extends MaybeEmptyDayRanges
DayRange
objects.This abstract class is not designed to be extended by third-party code, which is why it does not have an accessible constructor.
All concrete subclasses of this abstract class are immutable. You can safely reuse them and call them from multiple threads at once.
| Modifier and Type | Method and Description |
|---|---|
abstract DayRange |
fullRange()
Returns the non-null
DayRange extending from the first day
of the first DayRange to the last day of the last
DayRange in this chronologically-ordered set. |
abstract boolean |
isContiguous()
Returns
true if each contained DayRange starts
the day after the previous DayRange ended (i.e. no
gaps); false otherwise. |
static DayRanges |
of(java.util.Collection<DayRange> dayRangeObjects)
Returns a non-null
DayRanges object containing the specified
DayRange objects. |
static DayRanges |
of(DayRange[] dayRangeObjects)
Returns a non-null
DayRanges object containing the specified
DayRange objects. |
static DayRanges |
of(DayRange firstDayRangeObject,
DayRange... additionalDayRangeObjects)
Returns a non-null
DayRanges object containing the specified
DayRange objects. |
static DayRanges |
of(java.lang.Iterable<DayRange> dayRangeObjects)
Returns a non-null
DayRanges object containing the specified
DayRange objects. |
count, equals, fullRangeOrNull, get, getEmpty, hashCode, indexOf, indexOf, isEmpty, iterator, notEmpty, subRanges, subRangesWithin, toStringpublic abstract DayRange fullRange()
DayRange extending from the first day
of the first DayRange to the last day of the last
DayRange in this chronologically-ordered set.
Unlike MaybeEmptyDayRanges.fullRangeOrNull() this will never return
null because a DayRanges object will always
contain at least one DayRange.
public abstract boolean isContiguous()
true if each contained DayRange starts
the day after the previous DayRange ended (i.e. no
gaps); false otherwise.public static DayRanges of(DayRange[] dayRangeObjects)
DayRanges object containing the specified
DayRange objects.dayRangeObjects - a chronologically-ordered array of non-overlapping
DayRange objects. Cannot be null, cannot
contain null, and cannot be empty.java.lang.NullPointerException - if dayRangeObjects is
null or contains null.java.lang.IllegalArgumentException - if dayRangeObjects is
empty, or if any of the DayRange objects within it
overlap or are not in chronological order.of(DayRange, DayRange...),
of(Iterable)public static DayRanges of(java.util.Collection<DayRange> dayRangeObjects)
DayRanges object containing the specified
DayRange objects.dayRangeObjects - a chronologically-ordered collection of
non-overlapping DayRange objects. Cannot be
null, cannot contain null, and cannot be
empty.java.lang.NullPointerException - if dayRangeObjects is
null or contains null.java.lang.IllegalArgumentException - if dayRangeObjects is
empty, or if any of the DayRange objects within it
overlap or are not in chronological order.of(DayRange[]),
of(DayRange, DayRange...),
of(Iterable)public static DayRanges of(java.lang.Iterable<DayRange> dayRangeObjects)
DayRanges object containing the specified
DayRange objects.dayRangeObjects - a chronologically-ordered collection of
non-overlapping DayRange objects. Cannot be
null, cannot contain null, and cannot be
empty.java.lang.NullPointerException - if dayRangeObjects is
null or contains null.java.lang.IllegalArgumentException - if dayRangeObjects is
empty, or if any of the DayRange objects within it
overlap or are not in chronological order.of(DayRange[]),
of(DayRange, DayRange...)public static DayRanges of(DayRange firstDayRangeObject, DayRange... additionalDayRangeObjects)
DayRanges object containing the specified
DayRange objects.firstDayRangeObject - the first DayRange object to go in the
returned DayRanges object. Cannot be
null.additionalDayRangeObjects - the DayRange objects to follow
firstDayRangeObject in the returned
DayRanges object. Together with
firstDayRangeObject these must be
chronologically-ordered and non-overlapping. Cannot be
null, and cannot contain null.java.lang.NullPointerException - if firstDayRangeObject or
additionalDayRangeObjects is null, or
if additionalDayRangeObjects contains a
null value.java.lang.IllegalArgumentException - if any of the supplied DayRange
objects overlap or are not in chronological order.of(DayRange[]),
of(Iterable)
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.