Segment

data class Segment<V>(val interval: Interval, val value: V) : IntervalLike<Segment<V>>

A generic container that associates a value with an interval on a timeline.

Constructors

Link copied to clipboard
constructor(interval: Interval, value: V)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val interval: Interval
Link copied to clipboard

Functions

Link copied to clipboard
inline fun mapInterval(f: (Segment<V>) -> Interval): Segment<V>

Create a new segment with the same value, on a new interval derived from this segment.

Link copied to clipboard
inline fun <W> mapValue(f: (Segment<V>) -> W): Segment<W>

Create a new segment on the same interval, with a new value derived from this segment.

Link copied to clipboard
fun <V> Segment<V?>.transpose(): Segment<V & Any>?

Converts a non-null segment of a maybe-null value into a maybe-null segment of a non-null value.

Link copied to clipboard

Checks whether this segment's value equals another, using the basic equality operator.

Link copied to clipboard
open override fun withNewInterval(i: Interval): Segment<V>

Creates a new segment with the same value on a new interval.

Link copied to clipboard
fun <W> withNewValue(w: W): Segment<W>

Creates a new segment on the same interval with a new value.