-
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.
- Loading branch information
1 parent
dff3cb2
commit f4853ad
Showing
4 changed files
with
169 additions
and
19 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...e/e2e/procedural/scheduling/procedures/ExternalEventsEventAttributeOptionalQueryGoal.java
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,33 @@ | ||
package gov.nasa.jpl.aerie.e2e.procedural.scheduling.procedures; | ||
|
||
import gov.nasa.ammos.aerie.procedural.scheduling.Goal; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.SchedulingProcedure; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.plan.EditablePlan; | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.DirectiveStart; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Map; | ||
|
||
@SchedulingProcedure | ||
public record ExternalEventsEventAttributeOptionalQueryGoal() implements Goal { | ||
@Override | ||
public void run(@NotNull final EditablePlan plan) { | ||
// extract all events | ||
for (final var e: plan.events()) { | ||
// filter events that we schedule off of by their attributes | ||
var optionalValue = e.attributes.get("optional"); | ||
if (optionalValue != null) { | ||
var optional = optionalValue.asString(); | ||
if (optional.isPresent() && optional.get().equals("present")) { | ||
plan.create( | ||
"BiteBanana", | ||
// place the directive such that it is coincident with the event's start | ||
new DirectiveStart.Absolute(e.getInterval().start), | ||
Map.of("biteSize", SerializedValue.of(1))); | ||
} | ||
} | ||
} | ||
plan.commit(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../e2e/procedural/scheduling/procedures/ExternalEventsSourceAttributeOptionalQueryGoal.java
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,33 @@ | ||
package gov.nasa.jpl.aerie.e2e.procedural.scheduling.procedures; | ||
|
||
import gov.nasa.ammos.aerie.procedural.scheduling.Goal; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.SchedulingProcedure; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.plan.EditablePlan; | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.DirectiveStart; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Map; | ||
|
||
@SchedulingProcedure | ||
public record ExternalEventsSourceAttributeOptionalQueryGoal() implements Goal { | ||
@Override | ||
public void run(@NotNull final EditablePlan plan) { | ||
// extract all events | ||
for (final var e: plan.events()) { | ||
// filter events that we schedule off of by their source's attributes | ||
var optionalValue = e.source.attributes.get("optional"); | ||
if (optionalValue != null) { | ||
var optional = optionalValue.asString(); | ||
if (optional.isPresent() && optional.get().equals("present")) { | ||
plan.create( | ||
"BiteBanana", | ||
// place the directive such that it is coincident with the event's start | ||
new DirectiveStart.Absolute(e.getInterval().start), | ||
Map.of("biteSize", SerializedValue.of(1))); | ||
} | ||
} | ||
} | ||
plan.commit(); | ||
} | ||
} |
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