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
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
FieldsModifier and TypeFieldDescriptionprotected gov.nasa.jpl.aerie.merlin.protocol.types.Durationprotected Stringprotected PlanningHorizonprotected 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 -
Method Summary
Modifier and TypeMethodDescriptionattachStateConstraint(gov.nasa.jpl.aerie.constraints.tree.Expression<gov.nasa.jpl.aerie.constraints.time.Windows> constraint) allows to attach state constraints to the goalbuild()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 goalsendingAt(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 Goalpopulates 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 aboveforAllTimeIn(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 TgetThis()returns the current builder object (but typed at the lowest level) should be implemented by the builder at the bottom of the type heirarchysets 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.withinPlanHorizon(PlanningHorizon planHorizon)
-
Field Details
-
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
-
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
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
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
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
-
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
-
simulateAfter
-
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
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
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
-