unsafeOperate

open fun unsafeOperate(f: Timeline<V, THIS>.(opts: CollectOptions) -> List<V>): THIS

(DOC) UNSAFE! A simpler version of unsafeOperate for operations that don't change the timeline type.


(DOC) UNSAFE! The basic, most general operation method. All operations eventually delegate here.

This doesn't actually execute the operation, it just creates a BaseTimeline object that holds the operation for lazy evaluation later, when collect is called. It then wraps the base timeline in the provided constructor (called specialization) and coalesces the timeline if applicable.

Safety

This function is unsafe because all timeline types have mathematical invariants, such as ordered segments for profiles, and this method allows those invariants to be broken if the user is not careful. In particular, all timelines assume the result of collect will be contained in the bounds argument. These invariants are often maintained automatically, but you should never assume. Violating them is UB. Use at your own risk.

Parameters

ctor

the constructor of the new timeline type

f

a function which, given this and a CollectOptions object, produces a list of payload objects contained in the bounds. In Java, this is a two-argument function which takes a timeline object and CollectOptions. In Kotlin, this is a one-argument function of the options with a timeline receiver. (see the kotlin docs)