Class ActivityExpression.Builder

java.lang.Object
gov.nasa.jpl.aerie.scheduler.constraints.activities.ActivityExpression.Builder
Enclosing class:
ActivityExpression

public static class ActivityExpression.Builder extends Object
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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration
     
    protected 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<?>>>
     
    protected gov.nasa.jpl.aerie.constraints.time.Interval
     
    protected Pattern
     
    protected gov.nasa.jpl.aerie.constraints.time.Interval
     
    protected ActivityType
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    bootstraps a new query builder based on an existing activity instance the new builder may then be modified without impacting the existing activity instance, eg by adding additional new terms or replacing existing terms
    collect and cross-check all specified terms and construct the template creates a new template object based on a conjunction of all of the criteria specified so far in this builder multiple specifications of the same term sequentially overwrite the prior term specification the terms are checked for high level self-consistency, but it is still possible to construct predicates that will never match any activities
    durationIn(gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>> durationExpression)
    requires activities have a simulated duration at a specified value activities without a concrete simulated duration will not match
    durationIn(gov.nasa.jpl.aerie.merlin.protocol.types.Duration duration)
    requires activities have a simulated duration in a specified value activities without a concrete simulated duration will not match
    endsIn(gov.nasa.jpl.aerie.constraints.time.Interval range)
    requires activities have a scheduled end time in a specified range activities without a concrete scheduled start time will not match
    requires activities be of a specific activity type the matching instance is allowed to have a type that is derived from the requested type, akin to java instanceof semantics
    startsIn(gov.nasa.jpl.aerie.constraints.time.Interval range)
    requires activities have a scheduled start time in a specified range activities without a concrete scheduled start time will not match
    withArgument(String argument, gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?> val)
     
    withArgument(String argument, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue val)
     
    withArguments(Map<String,gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments)
     
    withTimingPrecision(gov.nasa.jpl.aerie.merlin.protocol.types.Duration acceptableAbsoluteTimingError)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • acceptableAbsoluteTimingError

      protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration acceptableAbsoluteTimingError
    • type

      protected ActivityType type
    • startsIn

      protected gov.nasa.jpl.aerie.constraints.time.Interval startsIn
    • endsIn

      protected gov.nasa.jpl.aerie.constraints.time.Interval endsIn
    • durationIn

      protected 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<?>>> durationIn
    • nameRe

      protected Pattern nameRe
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withArgument

      public ActivityExpression.Builder withArgument(String argument, gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue val)
    • withArgument

      public ActivityExpression.Builder withArgument(String argument, gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?> val)
    • withArguments

      public ActivityExpression.Builder withArguments(Map<String,gov.nasa.jpl.aerie.constraints.tree.ProfileExpression<?>> arguments)
    • withTimingPrecision

      public ActivityExpression.Builder withTimingPrecision(gov.nasa.jpl.aerie.merlin.protocol.types.Duration acceptableAbsoluteTimingError)
    • ofType

      requires activities be of a specific activity type the matching instance is allowed to have a type that is derived from the requested type, akin to java instanceof semantics
      Parameters:
      type - IN STORED required activity type for matching instances, which should not change while the template exists, or null if no specific type is required
      Returns:
      the same builder object updated with new criteria
    • startsIn

      public ActivityExpression.Builder startsIn(gov.nasa.jpl.aerie.constraints.time.Interval range)
      requires activities have a scheduled start time in a specified range activities without a concrete scheduled start time will not match
      Parameters:
      range - IN STORED the range of allowed values for start time, or null if no specific start time is required. should not change while the template exists. the range itself determines if inclusive or exclusive at its end points
      Returns:
      the same builder object updated with new criteria
    • endsIn

      public ActivityExpression.Builder endsIn(gov.nasa.jpl.aerie.constraints.time.Interval range)
      requires activities have a scheduled end time in a specified range activities without a concrete scheduled start time will not match
      Parameters:
      range - IN STORED the range of allowed values for start time, or null if no specific start time is required. should not change while the template exists. the range itself determines if inclusive or exclusive at its end points
      Returns:
      the same builder object updated with new criteria
    • durationIn

      public ActivityExpression.Builder durationIn(gov.nasa.jpl.aerie.merlin.protocol.types.Duration duration)
      requires activities have a simulated duration in a specified value activities without a concrete simulated duration will not match
      Parameters:
      duration - IN STORED the allowed duration, or null if no specific duration is required. should not change while the template exists. the range itself determines if inclusive or exclusive at its end points
      Returns:
      the same builder object updated with new criteria
    • durationIn

      public ActivityExpression.Builder durationIn(gov.nasa.jpl.aerie.constraints.tree.Expression<? extends gov.nasa.jpl.aerie.constraints.model.Profile<?>> durationExpression)
      requires activities have a simulated duration at a specified value activities without a concrete simulated duration will not match
      Parameters:
      durationExpression - IN STORED the allowed duration.
      Returns:
      the same builder object updated with new criteria
    • basedOn

      public ActivityExpression.Builder basedOn(SchedulingActivity existingAct)
      bootstraps a new query builder based on an existing activity instance the new builder may then be modified without impacting the existing activity instance, eg by adding additional new terms or replacing existing terms
      Parameters:
      existingAct - IN the activity instance that serves as the prototype for the new search criteria. must not be null.
      Returns:
      the same builder object updated with new criteria
    • getThis

      public ActivityExpression.Builder getThis()
    • basedOn

    • build

      public ActivityExpression build()
      collect and cross-check all specified terms and construct the template creates a new template object based on a conjunction of all of the criteria specified so far in this builder multiple specifications of the same term sequentially overwrite the prior term specification the terms are checked for high level self-consistency, but it is still possible to construct predicates that will never match any activities
      Returns:
      a newly constructed template that matches activities meeting the conjunction of all criteria specified to the builder