-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c27041
commit a693dcd
Showing
1 changed file
with
21 additions
and
7 deletions.
There are no files selected for viewing
28 changes: 21 additions & 7 deletions
28
timeline/src/main/kotlin/gov/nasa/jpl/aerie/timeline/collections/profiles/Windows.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |