map2OptionalValues

open fun <W : Any> map2OptionalValues(other: SerialSegmentOps<W, *>, op: NullBinaryOperation<V, W, V?>): THIS

(DOC) Performs a local binary operation between two profiles where the result is the same type as this profile.


(DOC) Performs a local binary operation between two profiles, with special treatment of gaps.

The operation will be evaluated on each pair of segments that overlap, with their intersection supplied as the interval argument to the NullBinaryOperation. The result of the operation is inserted in the result timeline at that intersection. Additionally, The operation will be evaluated on each segment in the profiles that overlaps with a gap in the other profile, and the gap will be indicated by a null in that operand's argument in NullBinaryOperation. The operation is not called for intervals that have a gap in both profiles - the result will automatically have a gap there.

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, try to shift the results in a separate operation.

Return

a coalesced profile; an instance of the return type of ctor

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