Class DoubleResource

java.lang.Object
gov.nasa.jpl.resource.Resource<Double>
gov.nasa.jpl.resource.DoubleResource
All Implemented Interfaces:
ResourceContainer
Direct Known Subclasses:
IntegratingResource

public class DoubleResource extends Resource<Double>
  • Constructor Details

    • DoubleResource

      public DoubleResource(double profile, String subsystem, String units, String interpolation, Double minimum, Double maximum)
    • DoubleResource

      public DoubleResource(String subsystem, String units, String interpolation)
    • DoubleResource

      public DoubleResource(double profile, String subsystem, String units, String interpolation)
    • DoubleResource

      public DoubleResource(double profile, String subsystem, String units)
    • DoubleResource

      public DoubleResource(double profile, String subsystem)
    • DoubleResource

      public DoubleResource(double profile)
    • DoubleResource

      public DoubleResource()
  • Method Details

    • profile

      public Double profile(Time t)
      Description copied from class: Resource
      Returns the default value of the resource before it is set() to a new value. Must be abstract since different data types have different intuitive defaults.
      Specified by:
      profile in class Resource<Double>
      Parameters:
      t - The time one wants the default value at. Used for custom resources that may have time-varying profiles.
      Returns:
    • add

      public void add(double toAdd)
    • subtract

      public void subtract(double toSubtract)
    • interpval

      public Double interpval(Time t)
      Returns the value of the resource at a time, linearly interpolating if the query time is not one in which the resource was explicitly set. This is in contrast to valueAt, which, if faced with querying the value at a time the resource was not set, returns the most recent update to the resource
      Parameters:
      t - The time at which you want the interpolated value of the resource
      Returns:
      The value of the resource as interpolated between two explicitly calculated values
    • getInterpolatedValue

      protected Double getInterpolatedValue(Time t, DoubleResource r)
      Performs the logic for interpolation for the input time and resource. This method is abstracted from interpval because IntegratingResource also has the same logic.
    • linearlyInterpolate

      protected Double linearlyInterpolate(Time interpolateTime, Time t1, Time t2, Double v1, Double v2)
      Performs linear interpolation using y = mx + b
    • update

      public void update()
      Description copied from class: Resource
      No-op method that adapters can override in custom resources
      Specified by:
      update in interface ResourceContainer
      Overrides:
      update in class Resource<Double>