Class Intervals
- java.lang.Object
-
- org.apache.druid.java.util.common.Intervals
-
public final class Intervals extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static org.joda.time.IntervalETERNITYstatic com.google.common.collect.ImmutableList<org.joda.time.Interval>ONLY_ETERNITY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanCompareEndpointsAsStrings(org.joda.time.Interval interval)Returns true if the provided interval has endpoints that can be compared against other DateTimes using their string representations.static org.joda.time.IntervalfindOverlappingInterval(org.joda.time.Interval searchInterval, org.joda.time.Interval[] sortedIntervals)Finds an interval from the given set of sortedIntervals which overlaps with the searchInterval.static booleanisEmpty(org.joda.time.Interval interval)static booleanisEternity(org.joda.time.Interval interval)Returns true if the provided interval contains all time.static org.joda.time.Intervalof(String interval)static org.joda.time.Intervalof(String format, Object... formatArgs)static org.joda.time.Intervalutc(long startInstant, long endInstant)
-
-
-
Method Detail
-
utc
public static org.joda.time.Interval utc(long startInstant, long endInstant)
-
of
public static org.joda.time.Interval of(String interval)
-
isEmpty
public static boolean isEmpty(org.joda.time.Interval interval)
-
canCompareEndpointsAsStrings
public static boolean canCompareEndpointsAsStrings(org.joda.time.Interval interval)
Returns true if the provided interval has endpoints that can be compared against other DateTimes using their string representations. See alsoDateTimes.canCompareAsString(DateTime).
-
isEternity
public static boolean isEternity(org.joda.time.Interval interval)
Returns true if the provided interval contains all time.
-
findOverlappingInterval
@Nullable public static org.joda.time.Interval findOverlappingInterval(org.joda.time.Interval searchInterval, org.joda.time.Interval[] sortedIntervals)
Finds an interval from the given set of sortedIntervals which overlaps with the searchInterval. If multiple candidate intervals overlap with the searchInterval, the "smallest" interval based on theComparators.intervalsByStartThenEnd()is returned.- Parameters:
searchInterval- Interval which should overlap with the resultsortedIntervals- Candidate overlapping intervals, sorted in ascending order, usingComparators.intervalsByStartThenEnd().- Returns:
- The first overlapping interval, if one exists, otherwise null.
-
-