Class StartOffsetReducer

java.lang.Object
java.util.concurrent.ForkJoinTask<HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>>>
java.util.concurrent.RecursiveTask<HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>>>
gov.nasa.jpl.aerie.merlin.driver.StartOffsetReducer
All Implemented Interfaces:
Serializable, Future<HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>>>

public class StartOffsetReducer extends RecursiveTask<HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>>>
See Also:
  • Constructor Details

    • StartOffsetReducer

      public StartOffsetReducer(gov.nasa.jpl.aerie.merlin.protocol.types.Duration planDuration, Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.types.ActivityDirective> activityDirectives)
  • Method Details

    • compute

      public HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>> compute()
      The complexity of compute() is ~O(NL), where N is the number of activities and L is the length of the longest chain In general, we expect L to be small.
      Specified by:
      compute in class RecursiveTask<HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>>>
    • adjustStartOffset

      public static List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>> adjustStartOffset(List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>> original, gov.nasa.jpl.aerie.merlin.protocol.types.Duration difference)
      Takes a List of Pairs of ActivityDirectiveIds and Durations, and returns a new List where the Durations have been uniformly adjusted. This will generally exclusively be called with the values mapped to the `null` key, in order to correct for the difference between plan startTime and simulation startTime.
      Parameters:
      original - The list to be used as reference.
      difference - The amount to subtract from the Duration of each entry in original.
      Returns:
      A new List with the updated Durations.
    • filterOutNegativeStartOffset

      public static HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>> filterOutNegativeStartOffset(HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>> toFilter)
      Takes a Hashmap and filters out all activities with a negative start offset, as well as any activities depending on the activities that were filtered out (and so on).
      Parameters:
      toFilter - The HashMap to be filtered.
      Returns:
      A new HashMap that has been appropriately filtered.
    • filterOutStartOffsetBefore

      public static HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>> filterOutStartOffsetBefore(HashMap<gov.nasa.jpl.aerie.types.ActivityDirectiveId,List<Pair<gov.nasa.jpl.aerie.types.ActivityDirectiveId,gov.nasa.jpl.aerie.merlin.protocol.types.Duration>>> toFilter, gov.nasa.jpl.aerie.merlin.protocol.types.Duration duration)