Skip to content

Commit

Permalink
Document windows
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCourtney committed Jan 26, 2024
1 parent 2c27041 commit a693dcd
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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<Segment<Boolean>, Windows>):
TimelineOps<Segment<Boolean>, Windows> by timeline,
/** A serial coalescing timeline of booleans. */
data class Windows(private val timeline: Timeline<Segment<Boolean>, Windows>):
Timeline<Segment<Boolean>, Windows> by timeline,
ConstantOps<Boolean, Windows>,
BooleanOps<Windows>,
SerialBooleanOps<Windows>,
CoalesceSegmentsNaive<Boolean, Windows>
{
constructor(v: Boolean): this(Timeline(::Windows) { bounds -> listOf(Segment(bounds, v)) })
constructor(segments: List<Segment<Boolean>>): 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<Segment<Boolean>>): 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<Boolean>): this(segments.asList())
}

0 comments on commit a693dcd

Please sign in to comment.