public class Interval
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.time.ZonedDateTime |
MAX_UTC |
Constructor and Description |
---|
Interval(java.time.ZonedDateTime earliestStart,
java.time.ZonedDateTime latestEnd)
internal constructor for creating an interval from ZoneDateTimes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Interval otherInterval)
checks if the supplied Interval is wholly contained within
this interval.
|
boolean |
contains(java.time.ZonedDateTime timestamp)
Contains logic is inclusive of start time, but exclusive of end time.
|
boolean |
equals(java.lang.Object obj) |
static Interval |
from(Interval interval)
create a new Inverval from an existing Interval
|
static Interval |
from(java.time.ZonedDateTime earliestStart,
java.time.ZonedDateTime latestEnd)
creates an Interval from two supplied ZoneDateTimes.
|
static Interval |
fromUTC(long earliestStart,
long latestEnd)
creates an Interval from to supplied longs representing epoch milliseconds.
|
java.time.ZonedDateTime |
getEnd()
gets the end time for the Interval
|
long |
getEpochMilliEnd()
gets the epoch millisecond time for the Interval end time.
|
long |
getEpochMilliStart()
gets the epoch millisecond time for the Interval start time.
|
java.time.ZonedDateTime |
getStart()
gets the start time for the Interval
|
int |
hashCode() |
boolean |
overlaps(Interval otherInterval)
checks if the supplied Interval overlaps with this Interval
|
java.time.Duration |
toDuration() |
java.lang.String |
toString() |
static java.time.ZonedDateTime |
toUTC(long millis)
Creates a ZonedDateTime from a long that represents epoch time in milliseconds.
|
static java.time.ZonedDateTime |
toUTC(java.time.ZonedDateTime zdt)
Converts a ZonedDateTime to UTC time
|
public Interval(java.time.ZonedDateTime earliestStart, java.time.ZonedDateTime latestEnd)
earliestStart
- the earliest startlatestEnd
- the latest endpublic static final Interval from(java.time.ZonedDateTime earliestStart, java.time.ZonedDateTime latestEnd)
earliestStart
- the start time for the intervallatestEnd
- the end time for the intervalpublic static final Interval fromUTC(long earliestStart, long latestEnd)
earliestStart
- the easliest start time in epoch millisecondslatestEnd
- he latest end time in epoch milliseconds. Pass in Long.MAX_VALUE to represent infinitypublic static final java.time.ZonedDateTime toUTC(java.time.ZonedDateTime zdt)
zdt
- the supplied ZoneDateTime that should be represented in UTC timepublic static final java.time.ZonedDateTime toUTC(long millis)
millis
- epoch time in millisecondspublic static final Interval from(Interval interval)
interval
- the existing Interval from which a new instance will be created.public java.time.ZonedDateTime getEnd()
public java.time.ZonedDateTime getStart()
public long getEpochMilliEnd()
public long getEpochMilliStart()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean contains(java.time.ZonedDateTime timestamp)
timestamp
- null equals now time. This is implemented same as
JodaTime lib for backward compatibilitypublic boolean overlaps(Interval otherInterval)
otherInterval
- the supplied Interval to check againstpublic java.time.Duration toDuration()
public boolean contains(Interval otherInterval)
otherInterval
- the supplied Interval to check againstpublic java.lang.String toString()
toString
in class java.lang.Object