Class Goal.Builder<T extends Goal.Builder<T>>

java.lang.Object
gov.nasa.jpl.aerie.scheduler.goals.Goal.Builder<T>
Direct Known Subclasses:
ActivityExistentialGoal.Builder, CompositeAndGoal.Builder, OptionGoal.Builder
Enclosing class:
Goal

public abstract static class Goal.Builder<T extends Goal.Builder<T>> extends Object
the builder can construct goals piecemeal via a series of specifier calls the builder's piecemal specifier method calls all modify the builder and return it so that such calls may be chained directly. multiple specifier calls will variously override previous specification or add on to the specification as documented by the individual specifier. the overall consistency of the specifiers is not finally enforced until the goal is built, but may be checked ahead of that time. the actual goal object is created at a final call to the build() method, which may also enforce consistency checks among prior specifiers. the builder remains viable after a build() call for further specification and creation of additional distinct goal objects. the builder uses the curriously recurring template pattern to ensure that it creates objects of the specific goal type but still allows the derived builders to leverage higher level specifier methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration
     
    protected String
     
    protected PlanningHorizon
     
    protected gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows>
     
    protected final List<gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows>>
     
    protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    attachStateConstraint(gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> constraint)
    allows to attach state constraints to the goal
    uses all pending specifications to construct a matching new goal object this is typically the last client call after a chain of specifiers, but the builder object remains viable to be further specified and build additional goals
    endingAt(gov.nasa.jpl.aerie.merlin.protocol.types.Duration end)
    sets the end of the time interval over which the goal is relevant this specifier is required unless a forAllTimeIn() is specified.
    protected Goal
    fill(Goal goal)
    populates the provided goal with specifiers from this builder and above typically called by any derived builder classes to fill in the specifiers managed at this builder level and above
    forAllTimeIn(gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> range)
    sets the contiguous time interval over which the goal is relevant this specifier is required unless a paired startingAt()/endingAt() is specified.
    protected abstract T
    returns the current builder object (but typed at the lowest level) should be implemented by the builder at the bottom of the type heirarchy
    named(String name)
    sets the human-legible name of the goal this specifier is required.
    shouldRollbackIfUnsatisfied(boolean shouldRollbackIfUnsatisfied)
     
    simulateAfter(boolean simAfter)
     
    startingAt(gov.nasa.jpl.aerie.merlin.protocol.types.Duration start)
    sets the beginning of the time interval over which the goal is relevant this specifier is required unless a forAllTimeIn() is specified.
     

    Methods inherited from class java.lang.Object

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

    • name

      protected String name
    • starting

      protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration starting
    • ending

      protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration ending
    • range

      protected gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> range
    • planHorizon

      protected PlanningHorizon planHorizon
    • resourceConstraints

      protected final List<gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows>> resourceConstraints
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • named

      public T named(String name)
      sets the human-legible name of the goal this specifier is required. it replaces any previous specification.
      Parameters:
      name - IN the human legible name of the goal
      Returns:
      this builder, ready for additional specification
    • startingAt

      public T startingAt(gov.nasa.jpl.aerie.merlin.protocol.types.Duration start)
      sets the beginning of the time interval over which the goal is relevant this specifier is required unless a forAllTimeIn() is specified. it replaces any previous specification. it must be paired with an ending() specification. it must not cooccur with a forAllTimeIn() specification.
      Parameters:
      start - IN the beginning of the time range that the goal is relevant
      Returns:
      this builder, ready for additional specification
    • endingAt

      public T endingAt(gov.nasa.jpl.aerie.merlin.protocol.types.Duration end)
      sets the end of the time interval over which the goal is relevant this specifier is required unless a forAllTimeIn() is specified. it replaces any previous specification. it must be paired with an starting() specification. it must not cooccur with a forAllTimeIn() specification.
      Parameters:
      end - IN the end of the time range that the goal is relevant
      Returns:
      this builder, ready for additional specification
    • forAllTimeIn

      public T forAllTimeIn(gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> range)
      sets the contiguous time interval over which the goal is relevant this specifier is required unless a paired startingAt()/endingAt() is specified. it replaces any previous specification. it must not cooccur with a starting() or ending() specification.
      Parameters:
      range - IN the time range that the goal is relevant
      Returns:
      this builder, ready for additional specification
    • withinPlanHorizon

      public T withinPlanHorizon(PlanningHorizon planHorizon)
    • attachStateConstraint

      public T attachStateConstraint(gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> constraint)
      allows to attach state constraints to the goal
      Parameters:
      constraint - IN the state constraints
      Returns:
      this builder, ready for additional specification
    • shouldRollbackIfUnsatisfied

      public T shouldRollbackIfUnsatisfied(boolean shouldRollbackIfUnsatisfied)
    • simulateAfter

      public T simulateAfter(boolean simAfter)
    • build

      public Goal build()
      uses all pending specifications to construct a matching new goal object this is typically the last client call after a chain of specifiers, but the builder object remains viable to be further specified and build additional goals
      Returns:
      a newly allocated goal object matching all specifications
    • getThis

      protected abstract T getThis()
      returns the current builder object (but typed at the lowest level) should be implemented by the builder at the bottom of the type heirarchy
      Returns:
      reference to the current builder object (specifically typed)
    • fill

      protected Goal fill(Goal goal)
      populates the provided goal with specifiers from this builder and above typically called by any derived builder classes to fill in the specifiers managed at this builder level and above
      Parameters:
      goal - IN/OUT a goal object to be filled with specifiers from this level of builder and above
      Returns:
      the provided goal object with details filled in