-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement plan.events(...) procedural scheduling query
- Loading branch information
1 parent
8118519
commit d2096f6
Showing
17 changed files
with
258 additions
and
8 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
...ne/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/collections/ExternalEvents.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gov.nasa.ammos.aerie.procedural.timeline.collections | ||
|
||
import gov.nasa.ammos.aerie.procedural.timeline.Timeline | ||
import gov.nasa.ammos.aerie.procedural.timeline.BaseTimeline | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.Instance | ||
import gov.nasa.ammos.aerie.procedural.timeline.ops.* | ||
import gov.nasa.ammos.aerie.procedural.timeline.ops.coalesce.CoalesceNoOp | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.ExternalEvent | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.ExternalSource | ||
import gov.nasa.ammos.aerie.procedural.timeline.util.preprocessList | ||
|
||
/** | ||
* A timeline of external events. | ||
*/ | ||
data class ExternalEvents(private val timeline: Timeline<ExternalEvent, ExternalEvents>): | ||
Timeline<ExternalEvent, ExternalEvents> by timeline, | ||
NonZeroDurationOps<ExternalEvent, ExternalEvents>, | ||
ParallelOps<ExternalEvent, ExternalEvents> | ||
{ | ||
constructor(vararg events: ExternalEvent): this(events.asList()) | ||
constructor(events: List<ExternalEvent>): this(BaseTimeline(::ExternalEvents, preprocessList(events, null))) | ||
|
||
/** Filter by one or more types. */ | ||
fun filterByType(vararg types: String) = filter { it.type in types } | ||
|
||
/** Filter by one or more event sources. */ | ||
fun filterBySource(vararg sources: ExternalSource) = filter { it.source in sources } | ||
|
||
/** Filter by one or more derivation groups. */ | ||
fun filterByDerivationGroup(vararg groups: String) = filter { it.source.derivationGroup in groups } | ||
} |
20 changes: 20 additions & 0 deletions
20
...meline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/payloads/ExternalEvent.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package gov.nasa.ammos.aerie.procedural.timeline.payloads | ||
|
||
import gov.nasa.ammos.aerie.procedural.timeline.Interval | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue | ||
|
||
/** An external event instance. */ | ||
data class ExternalEvent( | ||
/** The string name of this event. */ | ||
@JvmField | ||
val key: String, | ||
/** The type of the event. */ | ||
@JvmField | ||
val type: String, | ||
/** The source this event comes from. */ | ||
@JvmField | ||
val source: ExternalSource, | ||
override val interval: Interval, | ||
): IntervalLike<ExternalEvent> { | ||
override fun withNewInterval(i: Interval) = ExternalEvent(key, type, source, i) | ||
} |
14 changes: 14 additions & 0 deletions
14
...eline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/payloads/ExternalSource.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package gov.nasa.ammos.aerie.procedural.timeline.payloads | ||
|
||
/** | ||
* An external source instance. Used for querying purposes - see EventQuery.kt. | ||
* The included fields represent the primary key used to identify External Sources. | ||
*/ | ||
data class ExternalSource( | ||
/** The string name of this source. */ | ||
@JvmField | ||
val key: String, | ||
/** The derivation group that this source is a member of. */ | ||
@JvmField | ||
val derivationGroup: String, | ||
) |
35 changes: 35 additions & 0 deletions
35
...ural/timeline/src/main/kotlin/gov/nasa/ammos/aerie/procedural/timeline/plan/EventQuery.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package gov.nasa.ammos.aerie.procedural.timeline.plan | ||
|
||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.ExternalSource | ||
|
||
/** Fields for filtering events as they are queried. */ | ||
data class EventQuery( | ||
/** | ||
* A nullable list of derivation groups; the event must belong to one of them if present. | ||
* | ||
* If null, all derivation groups are allowed. | ||
*/ | ||
val derivationGroups: List<String>?, | ||
|
||
/** | ||
* A nullable list of eventTypes; the event must belong to one of them if present. | ||
* | ||
* If null, all types are allowed. | ||
*/ | ||
val eventTypes: List<String>?, | ||
|
||
/** | ||
* A nullable list of sources (described as a tuple of the source's (key, derivation group name)); the event must | ||
* belong to one of them if present. | ||
* | ||
* If null, all sources are allowed. | ||
*/ | ||
val sources: List<ExternalSource>?, | ||
) { | ||
constructor(derivationGroup: String?, eventType: String?, source: ExternalSource?): this( | ||
derivationGroup?.let { listOf(it) }, | ||
eventType?.let { listOf(it) }, | ||
source?.let { listOf(it) } | ||
) | ||
constructor(): this(null as String?, null, null) | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.