Class ActivityExpression.Builder
java.lang.Object
gov.nasa.jpl.aerie.scheduler.constraints.activities.ActivityExpression.Builder
- Enclosing class:
ActivityExpression
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
FieldsModifier and TypeFieldDescriptionprotected gov.nasa.jpl.aerie.merlin.protocol.types.Durationprotected 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.Intervalprotected Patternprotected gov.nasa.jpl.aerie.constraints.time.Intervalprotected ActivityType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbasedOn(ActivityExpression template) 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 termsbuild()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 activitiesdurationIn(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 matchdurationIn(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 matchendsIn(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 matchgetThis()ofType(ActivityType type) 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 semanticsstartsIn(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 matchwithArgument(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)
-
Field Details
-
acceptableAbsoluteTimingError
protected gov.nasa.jpl.aerie.merlin.protocol.types.Duration acceptableAbsoluteTimingError -
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
-
-
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
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
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
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
-
basedOn
-
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
-