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 type
nameRe - regular expression of matching activity instance names
arguments - 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 Classes
    Modifier and Type
    Class
    Description
    static class 
    a 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

    Constructors
    Constructor
    Description
    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 a ActivityExpression record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<String,gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>>
    Returns the value of the arguments record 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 the durationRange record component.
    gov.nasa.jpl.aerie.constraints.time.Interval
    Returns the value of the endRange record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    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)
     
    void
     
    final int
    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)
     
    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)
     
    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
    boolean
    matches(SchedulingActivity act, gov.nasa.jpl.aerie.constraints.model.SimulationResults simulationResults, gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment evaluationEnvironment, boolean matchArgumentsExactly, Plan plan)
     
    Returns the value of the nameRe record component.
    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.
     
    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.Interval
    Returns the value of the startRange record component.
    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
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods 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 a ActivityExpression record class.
      Parameters:
      startRange - the value for the startRange record component
      endRange - the value for the endRange record component
      durationRange - the value for the durationRange record component
      type - the value for the type record component
      nameRe - the value for the nameRe record component
      arguments - the value for the arguments record component
  • Method Details

    • ofType

      public static ActivityExpression ofType(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. 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:
      evaluate in interface gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
    • prettyPrint

      public String prettyPrint(String prefix)
      Specified by:
      prettyPrint in interface gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Spans>
    • extractResources

      public void extractResources(Set<String> names)
      Specified by:
      extractResources in interface gov.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 superset
      subset - the proposed subset
      Returns:
      true if subset is a subset of superset
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • startRange

      public gov.nasa.jpl.aerie.constraints.time.Interval startRange()
      Returns the value of the startRange record component.
      Returns:
      the value of the startRange record component
    • endRange

      public gov.nasa.jpl.aerie.constraints.time.Interval endRange()
      Returns the value of the endRange record component.
      Returns:
      the value of the endRange record 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 the durationRange record component.
      Returns:
      the value of the durationRange record component
    • type

      public ActivityType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • nameRe

      public Pattern nameRe()
      Returns the value of the nameRe record component.
      Returns:
      the value of the nameRe record component
    • arguments

      public Map<String,gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component