//core/io.islandtime.ranges/InstantInterval
InstantInterval¶
common
@Serializable(with = InstantIntervalIsoSerializer::class)
class InstantInterval(start: Instant = Instant.MIN, endExclusive: Instant = Instant.MAX) : TimePointInterval<Instant> , TimePointProgressionBuilder<Instant>
A half-open interval between two instants.
Instant.MIN and Instant.MAX are used as sentinels to indicate an unbounded (i.e. infinite) start or end.
Constructors¶
InstantInterval | common constructor(start: Instant = Instant.MIN, endExclusive: Instant = Instant.MAX) |
Types¶
Name | Summary |
---|---|
Companion | common object Companion |
Properties¶
Name | Summary |
---|---|
endExclusive | common open override val endExclusive: Instant The end of this interval, exclusive. |
endInclusive | common open override val endInclusive: Instant The end of this interval, inclusive. |
first | common open override val first: Instant |
last | common open override val last: Instant |
lengthInHours | common val TimePointInterval<*>.lengthInHours: Hours The number of whole hours between the start and end of this interval. |
lengthInMicroseconds | common val TimePointInterval<*>.lengthInMicroseconds: Microseconds The number of whole microseconds between the start and end of this interval. |
lengthInMilliseconds | common val TimePointInterval<*>.lengthInMilliseconds: Milliseconds The number of whole milliseconds between the start and end of this interval. |
lengthInMinutes | common val TimePointInterval<*>.lengthInMinutes: Minutes The number of whole minutes between the start and end of this interval. |
lengthInNanoseconds | common val TimePointInterval<*>.lengthInNanoseconds: Nanoseconds The number of nanoseconds between the start and end of this interval. |
lengthInSeconds | common val TimePointInterval<*>.lengthInSeconds: Seconds The number of whole seconds between the start and end of this interval. |
start | common open override val start: Instant The start of this interval, inclusive. |
Functions¶
Name | Summary |
---|---|
at | common infix fun InstantInterval.at(zone: TimeZone): ZonedDateTimeInterval Combines this InstantInterval with a TimeZone to create an equivalent ZonedDateTimeInterval where both endpoints are in zone. |
contains | common open operator override fun contains(value: Instant): Boolean Checks if this interval contains value. |
contains | common fun <T> Interval<T>.contains(value: T?): Boolean Checks if this interval contains value. common operator fun <T : TimePoint<T>> TimePointInterval<T>.contains(value: TimePoint<*>?): Boolean Checks if this interval contains value. This will always return false if value is null . |
equals | common open operator override fun equals(other: Any?): Boolean |
hasBoundedEnd | common open fun hasBoundedEnd(): Boolean Checks if this interval's end is bounded, meaning it has a finite value. |
hasBoundedStart | common open fun hasBoundedStart(): Boolean Checks if this interval's start is bounded, meaning it has a finite value. |
hashCode | common open override fun hashCode(): Int |
hasUnboundedEnd | common open override fun hasUnboundedEnd(): Boolean Checks if this interval's end is unbounded. In ISO-8601 terminology, this is an "open" end. |
hasUnboundedStart | common open override fun hasUnboundedStart(): Boolean Checks if this interval's start is unbounded. In ISO-8601 terminology, this is an "open" start. |
isBounded | common open fun isBounded(): Boolean Checks if both the start and end of this interval are bounded, meaning it has a finite range. |
isEmpty | common open override fun isEmpty(): Boolean Checks if this interval is empty. |
isUnbounded | common open fun isUnbounded(): Boolean Checks if both the start and end of this interval are unbounded, meaning this is an infinite time period in both directions. |
random | common fun InstantInterval.random(): Instant Returns a random date within this interval using the default random number generator. common fun InstantInterval.random(random: Random): Instant Returns a random date within this interval using the supplied random number generator. |
randomOrNull | common fun InstantInterval.randomOrNull(): Instant? Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded.common fun InstantInterval.randomOrNull(random: Random): Instant? Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded. |
step | common infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Days): TimePointSecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Hours): TimePointSecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Microseconds): TimePointNanosecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Milliseconds): TimePointNanosecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Minutes): TimePointSecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Nanoseconds): TimePointNanosecondProgression<T> infix fun <T : TimePoint<T>> TimePointProgressionBuilder<T>.step(step: Seconds): TimePointSecondProgression<T> |
toDateRangeAt | common fun InstantInterval.toDateRangeAt(zone: TimeZone): DateRange Converts this interval to the equivalent DateRange when both endpoints are in zone. |
toDateTimeIntervalAt | common fun InstantInterval.toDateTimeIntervalAt(zone: TimeZone): DateTimeInterval Converts this interval to the equivalent DateTimeInterval when both endpoints are in zone. |
toDuration | common fun TimePointInterval<*>.toDuration(): Duration Converts this interval into a Duration of the same length. |
toNSDateInterval | darwin fun <T : TimePoint<T>> TimePointInterval<T>.toNSDateInterval(): <Error class: unknown class> Converts this interval to an equivalent NSDateInterval . |
toNSDateIntervalOrNull | darwin fun <T : TimePoint<T>> TimePointInterval<T>.toNSDateIntervalOrNull(): <Error class: unknown class>? Converts this interval to an equivalent NSDateInterval , or null if the interval is unbounded. |
toString | common open override fun toString(): String Converts this interval to a string in ISO-8601 extended format. |