Class IntegratingResource

All Implemented Interfaces:
ResourceContainer, PropertyChangeListener, EventListener

public class IntegratingResource extends DoubleResource implements PropertyChangeListener
  • Constructor Details

  • Method Details

    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • 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.
      Overrides:
      profile in class DoubleResource
      Parameters:
      t - The time one wants the default value at. Used for custom resources that may have time-varying profiles.
      Returns:
    • updateFollowResource

      public void updateFollowResource()
      Updates the resource that this IntegratingResource is following at the current time. This will only update the value if there is not already a data point at the current time and if we are currently modeling.
    • interpval

      public Double interpval(Time t)
      Overrides the parent DoubleResource interpval to also update the followed resource so this resource will be correct during modeling.
      Overrides:
      interpval in class DoubleResource
      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
    • valueAt

      public Double valueAt(Time t)
      Overrides the parent valueAt. This always performs interpolation when available for the values defined in IntegratingResource. However, this method does not interpolate the followed resource values when calculating the integrating resource value.
      Overrides:
      valueAt in class Resource<Double>
      Parameters:
      t - The Time one wants the value at.
      Returns:
      The value (of whatever type) at the given time.
    • currentval

      public Double currentval()
      Overrides currentval to always use interpval for integrating resources.
      Overrides:
      currentval in class Resource<Double>
      Returns:
      Returns the value of the resource at the current simulated time.
    • add

      public void add(double toAdd)
      Integrating resource does not support the add method because it only tracks the followed resource changes.
      Overrides:
      add in class DoubleResource
    • subtract

      public void subtract(double toSubtract)
      Integrating resource does not support the subtract method because it only tracks the followed resource changes.
      Overrides:
      subtract in class DoubleResource
    • update

      public void update()
      The update method for this class only updates the followed resource so the current value of this resource is correct.
      Specified by:
      update in interface ResourceContainer
      Overrides:
      update in class DoubleResource