Record Class ActivityExpression
java.lang.Object
java.lang.Record
gov.nasa.jpl.aerie.scheduler.constraints.activities.ActivityExpression
- Record Components:
startRange- Range of allowed values for matching activity scheduled start times. Activities with null start time do not match any non-null range The range itself determines if endpoints are inclusive or exclusive.endRange- Range of allowed values for matching activity scheduled end times. Activities with null start time do not match any non-null range.durationRange- Range of allowed values for duration of matching activities.type- activity typenameRe- regular expression of matching activity instance namesarguments- arguments of matching activities.
- All Implemented Interfaces:
gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
public record ActivityExpression(gov.nasa.jpl.aerie.constraints.time.Interval startRange, gov.nasa.jpl.aerie.constraints.time.Interval endRange, org.apache.commons.lang3.tuple.Pair<gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>,gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>> durationRange, ActivityType type, Pattern nameRe, Map<String,gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments)
extends Record
implements gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
the criteria used to identify activity instances in scheduling goals
the template is a partial specification of an activity instance that
can be used to identify candidate activity instances in the plan. it
amounts to matching predicate or simple database record query
the template can be used by scheduling goals to identify both activities
that serve to satisfy the goal as well as other activities that trigger
some other conditions in the goal.
for example "an image activity of at least 10s duration taken with the
green filter" or "every orbit trim maneuver after JOI"
templates may be fluently constructed via builders that parse like first
order logic predicate clauses, used in building up scheduling rules
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classa fluent builder class for constructing consistent template queries using the builder is intended to read like a predicate logic clause each different term added to the builder via method calls become part of a logical conjection, ie matching activities must meet all of the specified criteria existing terms can be replaced by calling the same method again, ie matching activities must only meet the last-specified term the builder checks for consistency among all specified terms at least by the final build() call -
Constructor Summary
ConstructorsConstructorDescriptionActivityExpression(gov.nasa.jpl.aerie.constraints.time.Interval startRange, gov.nasa.jpl.aerie.constraints.time.Interval endRange, org.apache.commons.lang3.tuple.Pair<gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>, gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>> durationRange, ActivityType type, Pattern nameRe, Map<String, gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments) Creates an instance of aActivityExpressionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theargumentsrecord component.org.apache.commons.lang3.tuple.Pair<gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>, gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>> Returns the value of thedurationRangerecord component.gov.nasa.jpl.aerie.constraints.time.IntervalendRange()Returns the value of theendRangerecord component.final booleanIndicates whether some other object is "equal to" this one.gov.nasa.jpl.aerie.constraints.time.Spansevaluate(gov.nasa.jpl.aerie.constraints.model.SimulationResults results, gov.nasa.jpl.aerie.constraints.time.Interval bounds, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment environment) voidextractResources(Set<String> names) final inthashCode()Returns a hash code value for this object.Optional<gov.nasa.jpl.aerie.constraints.time.Interval> instantiateDurationInterval(PlanningHorizon planningHorizon, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment) booleanmatches(gov.nasa.jpl.aerie.constraints.model.ActivityInstance act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly) booleanmatches(SchedulingActivity act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly) determines if the given activity matches all criteria of this template if no criteria have been specified, any activity matches the templatebooleanmatches(SchedulingActivity act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly, Plan plan) nameRe()Returns the value of thenameRerecord component.static ActivityExpressionofType(ActivityType type) creates a template matching a given activity type (or its subtypes) shorthand factory method used in the common case of constraining activities by their type, equievelent to new ActivityTyemplate.prettyPrint(String prefix) reduceTemporalConstraints(PlanningHorizon planningHorizon, gov.nasa.jpl.aerie.merlin.protocol.model.SchedulerModel schedulerModel, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, List<gov.nasa.jpl.aerie.constraints.time.Interval> enveloppes) gov.nasa.jpl.aerie.constraints.time.IntervalReturns the value of thestartRangerecord component.static booleansubsetOrEqual(gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue superset, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue subset) Evaluates whether a SerializedValue can be qualified as the subset of another SerializedValue or notfinal StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface gov.nasa.jpl.aerie.constraints.tree.Expression
evaluate, evaluate, evaluate, prettyPrint
-
Constructor Details
-
ActivityExpression
public ActivityExpression(gov.nasa.jpl.aerie.constraints.time.Interval startRange, gov.nasa.jpl.aerie.constraints.time.Interval endRange, org.apache.commons.lang3.tuple.Pair<gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>, gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>> durationRange, ActivityType type, Pattern nameRe, Map<String, gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments) Creates an instance of aActivityExpressionrecord class.- Parameters:
startRange- the value for thestartRangerecord componentendRange- the value for theendRangerecord componentdurationRange- the value for thedurationRangerecord componenttype- the value for thetyperecord componentnameRe- the value for thenameRerecord componentarguments- the value for theargumentsrecord component
-
-
Method Details
-
ofType
creates a template matching a given activity type (or its subtypes) shorthand factory method used in the common case of constraining activities by their type, equievelent to new ActivityTyemplate. Builder().ofType(t).build().- Parameters:
type- IN STORED the required activity type for matching activities. not null.- Returns:
- an activity template that matches only activities with the specified super type
-
matches
public boolean matches(SchedulingActivity act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly) determines if the given activity matches all criteria of this template if no criteria have been specified, any activity matches the template- Parameters:
act- IN the activity to evaluate against the template criteria. not null.- Returns:
- true iff the given activity meets all of the criteria specified by this template, or false if it does not meet one or more of the template criteria
-
matches
public boolean matches(gov.nasa.jpl.aerie.constraints.model.ActivityInstance act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly) -
matches
public boolean matches(SchedulingActivity act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly, Plan plan) -
evaluate
public gov.nasa.jpl.aerie.constraints.time.Spans evaluate(gov.nasa.jpl.aerie.constraints.model.SimulationResults results, gov.nasa.jpl.aerie.constraints.time.Interval bounds, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment environment) - Specified by:
evaluatein interfacegov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
-
prettyPrint
- Specified by:
prettyPrintin interfacegov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
-
extractResources
- Specified by:
extractResourcesin interfacegov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
-
instantiateDurationInterval
public Optional<gov.nasa.jpl.aerie.constraints.time.Interval> instantiateDurationInterval(PlanningHorizon planningHorizon, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment) -
reduceTemporalConstraints
public Optional<TaskNetworkAdapter.TNActData> reduceTemporalConstraints(PlanningHorizon planningHorizon, gov.nasa.jpl.aerie.merlin.protocol.model.SchedulerModel schedulerModel, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, List<gov.nasa.jpl.aerie.constraints.time.Interval> enveloppes) -
subsetOrEqual
public static boolean subsetOrEqual(gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue superset, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue subset) Evaluates whether a SerializedValue can be qualified as the subset of another SerializedValue or not- Parameters:
superset- the proposed supersetsubset- the proposed subset- Returns:
- true if subset is a subset of superset
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
startRange
public gov.nasa.jpl.aerie.constraints.time.Interval startRange()Returns the value of thestartRangerecord component.- Returns:
- the value of the
startRangerecord component
-
endRange
public gov.nasa.jpl.aerie.constraints.time.Interval endRange()Returns the value of theendRangerecord component.- Returns:
- the value of the
endRangerecord component
-
durationRange
public org.apache.commons.lang3.tuple.Pair<gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>,gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>>> durationRange()Returns the value of thedurationRangerecord component.- Returns:
- the value of the
durationRangerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
nameRe
Returns the value of thenameRerecord component.- Returns:
- the value of the
nameRerecord component
-
arguments
Returns the value of theargumentsrecord component.- Returns:
- the value of the
argumentsrecord component
-