diff --git a/procedural/timeline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/util/ListUtils.kt b/procedural/timeline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/util/ListUtils.kt index 1bcb897faf..266f768647 100644 --- a/procedural/timeline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/util/ListUtils.kt +++ b/procedural/timeline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/util/ListUtils.kt @@ -28,7 +28,16 @@ fun > preprocessList(list: List, shouldCoalesce: (V.(V) -> fun > listCollector(list: List, isSorted: Boolean = false, isSerial: Boolean = false) = { opts: CollectOptions -> truncateList(list, opts, isSorted, isSerial) } -/** Eagerly truncates a list of timeline objects to known bounds. */ +/** + * Eagerly truncates a list of timeline objects to known bounds. + * + * `exploitSorted` and `isSerial` exist to provide extra information about the list, for performance optimization. + * + * @param list The list of [IntervalLike] objects to be sorted. + * @param opts Collect options, specifies the truncation bounds and behavior. + * @param exploitSorted Whether the start times of the intervals are sorted. + * @param isSerial Whether the list is "serial", i.e. sorted by start time AND non-overlapping. + */ fun > truncateList(list: List, opts: CollectOptions, exploitSorted: Boolean, isSerial: Boolean): List = if (opts.bounds == Interval.MIN_MAX || list.isEmpty()) list else if (!exploitSorted) {