From a693dcd4554a71c944d500a5c27d932d8024756a Mon Sep 17 00:00:00 2001 From: JoelCourtney Date: Thu, 25 Jan 2024 16:02:56 -0800 Subject: [PATCH] Document windows --- .../timeline/collections/profiles/Windows.kt | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/timeline/src/main/kotlin/gov/nasa/jpl/aerie/timeline/collections/profiles/Windows.kt b/timeline/src/main/kotlin/gov/nasa/jpl/aerie/timeline/collections/profiles/Windows.kt index 0dc8b7570d..357d9cf364 100644 --- a/timeline/src/main/kotlin/gov/nasa/jpl/aerie/timeline/collections/profiles/Windows.kt +++ b/timeline/src/main/kotlin/gov/nasa/jpl/aerie/timeline/collections/profiles/Windows.kt @@ -1,20 +1,34 @@ package gov.nasa.jpl.aerie.timeline.collections.profiles import gov.nasa.jpl.aerie.timeline.Segment +import gov.nasa.jpl.aerie.timeline.BaseTimeline import gov.nasa.jpl.aerie.timeline.Timeline -import gov.nasa.jpl.aerie.timeline.ops.TimelineOps -import gov.nasa.jpl.aerie.timeline.ops.BooleanOps import gov.nasa.jpl.aerie.timeline.ops.ConstantOps +import gov.nasa.jpl.aerie.timeline.ops.SerialBooleanOps import gov.nasa.jpl.aerie.timeline.ops.coalesce.CoalesceSegmentsNaive import gov.nasa.jpl.aerie.timeline.util.boundList -data class Windows(private val timeline: TimelineOps, Windows>): - TimelineOps, Windows> by timeline, +/** A serial coalescing timeline of booleans. */ +data class Windows(private val timeline: Timeline, Windows>): + Timeline, Windows> by timeline, ConstantOps, - BooleanOps, + SerialBooleanOps, CoalesceSegmentsNaive { - constructor(v: Boolean): this(Timeline(::Windows) { bounds -> listOf(Segment(bounds, v)) }) - constructor(segments: List>): this(Timeline(::Windows, boundList(segments))) + /** Constructs a windows timeline containing a single value for all time. */ + constructor(v: Boolean): this(BaseTimeline(::Windows) { bounds -> listOf(Segment(bounds, v)) }) + + /** + * Constructs a windows timeline from a list of boolean segments. + * + * Assumes the segments are properly sorted and coalesced. NOT CHECKED. + */ + constructor(segments: List>): this(BaseTimeline(::Windows, boundList(segments))) + + /** + * Constructs a windows timeline from a vararg list of boolean segments. + * + * Assumes the segments are properly sorted and coalesced. NOT CHECKED. + */ constructor(vararg segments: Segment): this(segments.asList()) }