map2Values

open fun map2Values(other: SegmentOps<V, *>, op: (V, V, Interval) -> V?): THIS

(DOC) A simplified version of map2Values for operations that don't change the timeline type.


open fun <W : Any, R : Any, RESULT : SegmentOps<R, RESULT>> map2Values(ctor: (Timeline<Segment<R>, RESULT>) -> RESULT, other: SegmentOps<W, *>, op: (V, W, Interval) -> R?): RESULT

(DOC) Performs a local binary operation between two segment-valued timelines.

The operation will be evaluated on each pair of segments that overlap, with their intersection supplied as the interval argument to the operation. The result of the operation is inserted in the result timeline at that intersection.

The binary operation may return null, which indicates that the result profile should have a gap.

The operation is "local", meaning that while the operation is allowed to know when it is being evaluated, it is not allowed to change where the result segment should be placed. For that, consider using unsafeMap2 or (ideally) shifting the results in a separate operation.

Return

a new timeline of segments

Parameters

W

the other operand's payload type

R

the result's payload type

RESULT

the result's timeline type

ctor

the result timeline's constructor

other

the other operand timeline

op

a binary operation between the two payload types that produces a maybe-null result