Skip to content

Commit

Permalink
add source support finished
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-super committed Oct 23, 2024
1 parent c2a5b48 commit aede544
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ 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> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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 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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ data class SchedulerToProcedurePlanAdapter(
}
else eventsByDerivationGroup.values.flatten()
if (query.eventTypes != null) result = result.filter { it.type in query.eventTypes!! }
if (query.sources != null) result = result.filter { event ->
query.sources!!.map { it.key }.contains(event.source.key) && query.sources!!.map { it.derivationGroup }.contains(event.source.key)
}
if (query.sources != null) result = result.filter { it.source in query.sources!! }
return ExternalEvents(result)
}
override fun <V : Any, TL : SerialSegmentOps<V, TL>> resource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ public Map<String, List<ExternalEvent>> getExternalEvents(final PlanId planId, f
final var unorganized = parseExternalEvents(data, horizonStart);
final var result = new HashMap<String, List<ExternalEvent>>();
for (final var event: unorganized) {
final var list = result.computeIfAbsent(event.getDerivationGroup(), $ -> new ArrayList<>());
final var list = result.computeIfAbsent(event.source.derivationGroup, $ -> new ArrayList<>());
list.add(event);
}
return result;
Expand Down

0 comments on commit aede544

Please sign in to comment.